ASP.NET Redirect without referrer

I am trying to redirect to a page from the server without referrer. Right now I am doing redirect like this:
ASP.NET Redirect without referrer

I haven’t found any overloads for Redirect method or any other ways to redirect without referrer so it’s present on the page:
ASP.NET Redirect without referrer

So is there any solution to redirect without referrer in ASP.NET?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can’t handle the referrer from the Redirect method, but you can do one of the following:

  1. Launch the new page on a new window.
  2. Using a meta tag on the content page as follows:

    <meta name="referrer" content="no-referrer" />
    Or you can add the tag following this answer: How to add meta tag to ASP.Net content page

  3. Move the redirect logic to the front and use rel(attribute specifies the relationship between the current document and the linked document) use:

    <a href="exampleurl.com" rel="noreferrer">link</a>

Method 2

I think you’re asking “after my C# server code sends a redirect to the client browser, telling it to go somewhere else, I want the browser to NOT put my site URL into the Referer header when it goes to that somewhere else”

You can’t, if it’s direct, unless you’re redirecting from a secure page (yours) to an insecure page (theirs)

You’ll probably have to create an interim page that you redirect to, that has some client side scripting that performs the actual transition (like those “thanks for searching your flight with expedia, please wait while we transfer you to the airline to complete your booking” type pages) because then you can take control of what their browser sends; if you straight refer them, you can’t


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x