A strange # _ = _ appears at the end of the url after response.redirect ASP.NET

Has anyone here, using the Response.Redirect() method, did you encounter some weird characters attached to the end of the uri in the address bar of the browser?
Strange characters: hash, underscore, equal sign and underscore (without spaces), for example below ... I have no idea what it is and when these strange characters appear, the redirection does not occur properly.

  #_=_ 

Any ideas on this, please share. Thanks

+6
source share
2 answers

Everything in the location-part URL following # refers to the anchor on the page, usually <a name=""> or <whatever id=""> . Some websites use them (possibly with client-side Javascript) to do the magic, but since you ask about it, I feel this is not the case. So, there is no real rhyme or reason why the existence or absence of these characters alone will cause the redirection to work or not. In fact, they are not even sent to the server in an HTTP request (at least Firefox does not work).

Have you looked at the exchange of HTTP requests when this happens? Something like Live HTTP Headers, HttpFox or Firebug (look at the Net panel) will help you with this and may tell you where the erroneous #_=_ comes from.

+1
source

Here my solution is based on other pairs:

 $(function () { if (window.location.href.indexOf("#_=_") > -1) { //remove facebook oAuth response bogus hash if (window.history && window.history.pushState) { history.pushState('', document.title, window.location.pathname); } else { window.location.href = window.location.href.replace(location.hash, ""); } } }); 

fooobar.com/questions/662610 / ...

fooobar.com/questions/181334 / ...

fooobar.com/questions/79069 / ...

+1
source

Source: https://habr.com/ru/post/898503/


All Articles