9

When I attempt to add either parameters or query string values to the context inside an action filter, an exception gets raised to say that the collection is read only.

I would like to add values to the 'outgoing' url when it is created.

filterContext.ActionParameters.Add("test", "test");

I need these values passed on to the query string, or in the request parameters. Thanks

1
  • these collections reflect the incoming request and can not be changed. Commented Nov 17, 2012 at 13:26

1 Answer 1

8

HttpContext.Request.Params is read only. It's reflects the incoming request.

Consider using HttpContext.Items to save our own objects/values

filterContext.HttpContext.Items.Add("test","test")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.