I develop an ASP.NET MVC application and I need to get url of youtube page, from user goes to my page. For example, on youtube.com under my video I put a link to my web-site. When user goes to my website I should receive link to youtube page. I try to receive this link using the next code:
Request.UrlReferrer
but when I go to my page from youtube.com the Request.UrlReferrer is null.
Also, note, that I click on my link on youtube.com page I go to my page thru page like:
https://www.youtube.com/redirect?q=http%3A%2F%2mysite.azurewebsites.net%2FHome%2FFillForm%3FFormID%3DbdHN7K9oFkQ&redir_token=tl-svjka0c6n2TVko3CXXXoDak18MTM5NzMyODMwMUAxMzk3MjQxOTAx
How can I get UrlReferrer value?
This is most likely caused by the fact that it's redirecting from an https URL to an http URL and the browser gets paranoid about security.
That said, the referer header is not guaranteed to be sent in any case and your logic can't depend on it being available.
Related
I am working on a MVC application in which when have an option to request password reset email. When we got the email with the link, that link will redirect to the welcome page where we will enter Password and Confirm password and then we will click continue. Once all the validations of Welcome page passed, the user will be redirected to Dashboard page where we are loading few widgets through ajax calls. In one of our production environment these ajax calls are giving 302 http code instead of 200. Due to this behavior the widgets are loading either welcome page or login page as their content instead of original content. From the code base, no where we are redirecting to Welcome page or login page from any of the widget ajax calls. As this is happening in only production environment but not in local, it became hard to debug.
Can anyone please help guide me on how to figure out the cause of redirection.
Thanks....
I am trying to redirect to a page from the server without referrer. Right now I am doing redirect like this:
I haven't found any overloads for Redirect method or any other ways to redirect without referrer so it's present on the page:
So is there any solution to redirect without referrer in ASP.NET?
You can't handle the referrer from the Redirect method, but you can do one of the following:
Launch the new page on a new window.
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
Move the redirect logic to the front and use rel(attribute specifies the relationship between the current document and the linked document) use:
link
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
I am looking for a method that will forward my form post. I have an outside source posting me SAML, I need them to POST to my defualt page to create a cookie before I can redirect them to the page they can operate on. The issue I am having is when I redirect them to the page they can work on the form variables (post data) is lost. I can see in fiddler I am receiving their SAML in the WebForms, but when I response.redirect to the next page, the form data is gone. I understand this is because response.redirect does a get, I was wondering if someone knew of another method, or solution to this problem. Thanks in advance.
Client Posts Saml To My default page -> my default page redirects to a shopping page (because the shopping page creates a non-user cookie) -> the shopping page then redirects to a results page (the results are based off of what is in the saml). Short: I need to preserve the initial SAML posted to me across multiple pages so I can process it on my results page. I would like to continually post it to each intermediate page.
Write a POST form to the page, fill in the data, and also write some JS code that triggers a submit. For example ADFS does this with SAML tokens.
I have an asp.net C# website its url is like abc.com so when the website is loaded for the first time its url that appears is abc.com
But when i visit any other page and come backs to the home page its url become abc.com/home.aspx.
But i want it to be the same i.e abc.com means i want that the url that appears when the website is loaded for the first time and the url that appears for the home page after visiting any other page should be same.
I think url rewriting will be used here but i am not sure neither i have any knowledge how to use it so please help.
By default this happens because of Default Document feature.. You can read about more from http://www.iis.net/learn/web-hosting/web-server-for-shared-hosting/default-documents link.
However once you open us the website abc.com and when you navigate it will surely show you the page name like www.abc.com/home.aspx
And thus what you are looking for seems not possible.
You can use link tag marking the canonical in the header of the page. So, in abc.com/home.aspx you can generate the link tag that tells crawlers that this is a duplicate of abc.com and dont crawl it.
Here are more reference regarding the same subject:
http://www.seomoz.org/blog/which-page-is-canonical
http://guyellisrocks.com/coding/adding-a-canonical-link-element-in-asp-net/
If you see your home page when you visit abc.com it looks like your default page is set in place.
You can easily redirect user to "/" and it probably will be enough
Here is my situation:
Page1.aspx redirects to Page2.aspx which does some processing (does not display to the user) and then redirects to Page3.aspx which checks the ServerVariables["HTTP_REFERER"] or Request.UrlReferrer.
I understand that the referring information can sometimes be blank and can't be entirely relied upon; however the ServerVariables["HTTP_REFERER"] or Request.UrlReferrer on Page3.aspx is showing Page1.aspx instead of Page2.aspx which I would have expected.
Does the referring information only get set if the page displays to the user?
Redirecting is done using Response.Redirect in order to change the URL in the address bar of the browser.
because the http redirect instructs the browser to find the page in a new place, so the browser assumes it's still dealing with the original request on page1.aspx, and hence sends that through as the referer :)
it's worth bearing in mind that the referer is just sent through from the browser and hence cannot be trusted 100% - some proxies remove it altogether for example.
I believe part of it depends on how the page is being redirected: Server.Transfer or Response.Redirect.
http://haacked.com/archive/2004/10/06/responseredirectverseservertransfer.aspx