I am trying to pass a query string parameter from one controller to another through RedirectToAction method.
However, my parameter name is something like "abc.Key" but I am not being able specify such a value to RedirectToaction as it gives me error.
My RedirectToAction currently looks like this:
return RedirectToAction("Pending", "SimpleController",
new { area = "Area1", Activities.ActivityGroupKey=qstring });
I searched a lot to figure out how it can be done but to no fruits.
To pass in parameter values, simply append them to the query string at the end of the base URL. In the above example, the view parameter script name is viewParameter1.
However, regardless of whether the query string is used or not, the whole URL including it is stored in the server log files. These facts allow query strings to be used to track users in a manner similar to that provided by HTTP cookies.
Generally, the query string is one of client-side state management techniques in ASP.NET in which query string stores values in URL that are visible to Users. We mostly use query strings to pass data from one page to another page in asp.net mvc. In asp.net mvc routing has support for query strings in RouteConfig.
I ended up using RouteValueDictionary
to solve my problem
This is How I did it:
return RedirectToAction("Pending", "SimpleController", new RouteValueDictionary{
{ "area","Area1" },
{ "Activities.ActivityGroupKey",qstring}
} );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With