In my asp.net-mvc project I do a redirect from a post request to a get request.
In between my redirect and my arrival of the method I expect it to arrive, one of my parameters magically turns into null and I can't figure out why.
Probably it has something to do with my global.asax (route defenition).
The only way I can come up with to debug this is with the route debugger library. But I don't see how I can use it with a RedirectToRoute.
Any suggestions?
A little late to the party but this was the first hit on Google for an issue I was having so thought I'd share my experience.
I wanted to parse a RedirectToRouteResult
to a URL so I can redirect to it at a later stage, but this class has no method to do this. You can, however, use UrlHelper.RouteUrl()
, e.g:
Url.RouteUrl(redirectResult.RouteName, redirectResult.RouteValues);
where Url
is property of Controller
class.
A redirect is a result sent to the browser, and then the browser honors the redirect by doing a GET on the new URL. Therefore, look at the browser to see what the URL is. When the browser receives the redirect, it will do a GET on the new URL, which you can see with Firebug, Fiddler, or the tool of your choice.
Inside the new action, when it is called, you can also examine Request.Url.
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