5

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.

Jason P
  • 26,984
  • 3
  • 31
  • 45
Shubhada Fuge
  • 242
  • 2
  • 12
  • What error does it give you? There is [similar question](http://stackoverflow.com/questions/25429281/error-with-dot-character-in-url) right next to yours. – Ilya Luzyanin Aug 21 '14 at 15:30
  • The question you are referring to is regarding error because of dot in URL. My question is about how I can write the parameter name with a dot in RedirectToAction method. – Shubhada Fuge Aug 21 '14 at 16:03
  • My bad. And how does your other method looks like, what does it get as input parameter? – Ilya Luzyanin Aug 21 '14 at 16:12
  • RedirectToAction is an ASP.NET MVC method, which is used to redirect to a controller/action. Refer here http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.redirecttoaction(v=vs.118).aspx – Shubhada Fuge Aug 21 '14 at 16:18

1 Answers1

5

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}
    } );
Shubhada Fuge
  • 242
  • 2
  • 12