奇怪的#_=_出现在response.redirect ASP.NET之后的url末尾
这里有人使用 Response.Redirect() 方法,您是否遇到过浏览器地址栏上 uri 末尾附加的一些奇怪字符?
奇怪的字符是哈希、下划线、等号和下划线(不含空格),如下所示...我不知道这些是什么意思,当这些奇怪的字符出现时,重定向并没有正确地发生。
#_=_
对此有任何见解请分享。谢谢
Anyone here using Response.Redirect()
method, do have you encountered some strange characters attached to the end of the uri on the browser address bar?
The strange characters are hash, underscore, equal sign and underscore (without spaces) such as below... I have no idea what are these all about and when these strange characters appear, the redirection didn't happen properly.
#_=_
Any insights on this please share. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
URL 的
location-part
中#
后面的任何内容均指页面中的锚点,通常是< /code> 或
<无论 id="">
。有些网站使用它们(可能与客户端 Javascript 一起)来执行魔法,但既然你问这个,我感觉你的情况并非如此。因此,没有真正的韵律或理由表明这些字符本身的存在或不存在会导致重定向是否有效。事实上,它们甚至不会在 HTTP 请求中发送到服务器(至少 Firefox 不会)。您是否查看过发生这种情况时的 HTTP 请求交换?像 Live HTTP Headers、HttpFox 或 Firebug(查看 Net 面板)之类的东西将帮助您解决此问题,并且可能会向您指出错误的
#_=_
的来源。Anything in the
location-part
of a URL that follows a#
refers to an anchor in the page, usually an<a name="">
or<whatever id="">
. Some web sites use them (probably with client-side Javascript) to perform magic, but since you are asking this, I get the feeling that's not the case for you. So, there's no real rhyme or reason to that the existence or absence of those characters in and of themselves would cause the redirection to work or not. In fact, they aren't even sent to the server in the HTTP request (at least, Firefox doesn't).Have you had a look at the HTTP request exchanges when this is happening? Something like Live HTTP Headers, HttpFox or Firebug (look at the Net panel) will help you with this, and might point you to where the errant
#_=_
is coming from.这是我基于其他几个人的解决方案:
https://stackoverflow.com/a/7845639/1467810
https://stackoverflow.com/a/15323220/1467810
https://stackoverflow.com/a/2295951/1467810
Here's my solution based on a couple others out there:
https://stackoverflow.com/a/7845639/1467810
https://stackoverflow.com/a/15323220/1467810
https://stackoverflow.com/a/2295951/1467810