我注意到Stackoverflow登录/注销链接上的returnurl URL参数没有被转义,但是当我尝试将路径作为参数添加到路由时,它会被转义.
所以/ login?returnurl =/questions/ask shows/login?returnurl =%2fquestions%2fask,这有点难看.如何让它不能逃避returnurl值?
这是我在代码中所做的事情:
Html.ActionLink("Login", "Login", "Account", new { returnurl=Request.Path }, null)
Buu Nguyen.. 7
如何让它不能逃避returnurl值
怎么样?
var url = Url.Action("Login", "Account", new {returnurl = Request.Path}); var unEncodedUrl = HttpUtility.UrlDecode(url); Response.Write("...");
确保这是你想要的,URL编码有其目的.
如何让它不能逃避returnurl值
怎么样?
var url = Url.Action("Login", "Account", new {returnurl = Request.Path}); var unEncodedUrl = HttpUtility.UrlDecode(url); Response.Write("...");
确保这是你想要的,URL编码有其目的.