Basically I am try to add some custom query parameter into my all browser request using MVC action filter.
I am try to add action filter and write below code but getting error. like: NotSupportedException: Collection was of a fixed size.
public class CustomActionFilters : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
filterContext.RouteData.Values.Keys.Add("customPara");
filterContext.RouteData.Values.Values.Add("myAllcustomparamter");
//OR
filterContext.HttpContext.Request.Query.Keys.Add("customPara=myAllcustomparamter");
}
}
So if I am write into url :http://localhost:15556/
than it will be http://localhost:15556?customPara=myAllcustomparamter
if open any other page like http://localhost:15556/image than it will be http://localhost:15556/image?customPara=myAllcustomparamter OR http://localhost:15556/image?inbuildparamter=anyvalue it will be http://localhost:15556/image?inbuildparamter=anyvalue&customPara=myAllcustomparamter