I am developing an Asp.net MVC project. I am having a problem with redirect url.
I have a link like this.
<a href="@Url.Content("~/Account/Login&ReturnUrl="+Url.Encode(Request.Url.PathAndQuery))">Log in</a>
You can see I added a ReturnUrl query value to the end of url because I want to redirect the user to current url after login.
Request.Url.PathAndQuery return string like this
/Item/Details?name=test&id=4
When I click the link, it is giving me error:
The request filtering module is configured to deny a request that contains a double escape sequence.
Url value is like this:
http://localhost:50489/Account/Login&ReturnUrl=%2fItem%2fDetails%3fname%3dtest%25203%26id%3d4
I cannot use Html.ActionLink because I need to add some html content inside anchor tag.
How can I pass current URL to as ReturnUrl value to log in page?