Ok, this is a bit tricky. I'm implementing a forum in ASP.NET MVC 3. The user wants to post a question, if not logged he gets redirected to the logon page. A returnUrl parameter is passed to the logon page. However, the returnUrl parameter also contains another returnUrl parameter. So the returnUrl parameter passed to the logon page looks like this:
"/forum/NewTopic?boardId=8&returnUrl=%2Fforum%2FBoard%2F8"
But, Request["returnUrl"] looks like this:
"/forum/NewTopic?boardId=8&returnUrl=%2Fforum%2FBoard%2F8,/forum/Board/8"
Notice the appended bit at the end, that shouldn't be there should it? How do I get the proper returnUrl?
However, when having a string returnUrl argument in the controller's action method, this will have the correct returnUrl value.
I had this problem in MVC3 also, check if the redirecting page is "Login", set a flag, not to add the returnUrl parameter (which is the last appended bit at the end).
This way it does not get populated again.
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