我想在C#中重定向之前从Request.UrlReferrer.AbsoluteUri中删除Querystring部分.
例如,如果你有你的
Request.UrlReferrer.AbsoluteUri = "http://localhost:8080/english/index_2011.aspx?logout=true"
Run Code Online (Sandbox Code Playgroud)
现在我想
Response.Redirect(Request.UrlReferrer.AbsoluteUri) without QueryString part (?logout=true")
Run Code Online (Sandbox Code Playgroud)
请建议使用C#
一种更干净的方式
Request.UrlReferrer.GetLeftPart(UriPartial.Path)
Run Code Online (Sandbox Code Playgroud)
意思是我希望一切顺利.它应该回来
"http://localhost:8080/english/index_2011.aspx"
Run Code Online (Sandbox Code Playgroud)
的Response.Redirect(Request.UrlReferrer.AbsoluteUri.Substring(0,Request.UrlReferrer.AbsoluteUri.IndexOf()) '?');
编辑
事实上,你实际上可以使用:
Response.Redirect(Request.UrlReferrer.AbsolutePath);
Run Code Online (Sandbox Code Playgroud)
在MSDN上查看.
| 归档时间: |
|
| 查看次数: |
10010 次 |
| 最近记录: |