Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass Query String Parameter name with a dot in RedirectToAction

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.

like image 888
Shubhada Fuge Avatar asked Aug 21 '14 13:08

Shubhada Fuge


People also ask

How do you pass a string in a query?

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.

Where does the query string store information?

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.

What is query string in ASP net MVC?

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.


1 Answers

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}
    } );
like image 134
Shubhada Fuge Avatar answered Oct 12 '22 19:10

Shubhada Fuge