Referrer stripped when coming from Google site builder page? - c#

Can anyone verify what I am seeing is not a bug? I am checking the referrer when someone comes to my site which is an ASP.NET C# store site. When I link from any of the other sites I control, my main page sees the referrer properly.
I am trying to support another third-party site that's linking to me and they have a Google site page at sites.google.com/site/whatever and when I follow that link my referrer on my main page is blank.
Is that something Google is doing or is it a truly bizarre bug in my code. (I know you can't see my code but I would like verification that Google is stripping referrer from their sites.google pages please.)
Thanks

Google Sites is HTTPS by default, which means no referrer data is passed. This may be part of Google's move to HTTPS across the board. Implications discussed here.
HTTP RFC says referrers shouldn't be sent when going from HTTPS to HTTP. Not sure if HTTPS to HTTPS will work either. See discussion here.

Related

301 redirect to prevent duplicate Google Analytics when /en/ is in URL

We are using the latest Episerver (9) and have multiple site languages - English and Welsh. Our Google Analytics is creating Duplicate URL results because the site uses *.com/en/testpage and *.com/testpage. We can't use IIS rewrite Tool to create a 301 as we use Azure to host the site.
Does anyone know the best way to create a 301 redirect in c# to prevent Duplicate entries in GA?
Thanks
Jon
You can also render a canonical link in your layout.
#Html.CanonicalLink()
Please see https://github.com/episerver/AlloyDemoKit/blob/master/src/AlloyDemoKit/Views/Shared/Layouts/_Root.cshtml

ADFS 2.0 signout redirect not functioning

In order to sign out of a web app using ADFS for authentication, using a URL that follows this form:
https://{DNS_name_of_RP_STS}/adfs/ls/?wa=wsignout1.0&wreply={post-sign-out_landing_URL}
works fine. The user is taken to an ADFS site page that notifies them that they've signed out. What isn't happening is redirecting back to the web app. I've spent a long time looking around online and I am pretty confused now as to if this is possible with the wreply parameter or not. There are a few spots on msdn and blogs where it is said to just work by supplying a wreply value, but it seems like most people are not having any luck with navigating back to the RP site.
Question: On signing out from ADFS, is it possible to automatically return to the RP app? Has anyone done this successfully? There's a "Sign in as different user" option that needs to end up with the user seeing the RP sign in page.
Thanks in advance to anyone who replies.
The url cannot be just any url but rather the same exact url your application is registered in adfs for.
The redirect works and always worked for us.

Getting the Google search terms from a https Google search

I want to get the search terms that user typed on Google to get to my long-tail landing page (and use them on that page).
Getting the the "q" variable from the query string using the response referrer (in ASP C#) works well but only if the referring Google page was not loaded as https.
This is obviously a problem due to the fact that almost everyone is logged in to their Google accounts on their browsers all the time and, if they are, all Google pages will be automatically loaded (and redirected) to use https.
When a user (on https://www.google.com) searches for something and clicks on a search result, Google seems to redirect the user to an intermediate page that strips the request of its query string and replaces it with a different one that pretty much only contains url that the intermediate page should redirect to (i.e. the url to my long-tail landing page).
Is there any way that I can get the original search terms that were used on https://www.google.com anyway? Maybe if JavaScript could access the browser history or something similar?
Is there any way that I can get the original search terms that were used on https://www.google.com
No, the full text of the https session is secured via SSL this includes headers, urls etc. In your scenario, for security reasons browers tend to omit the referer header therefore you won't be able to access it (unless the destination URL is also secured via HTTPS). This is part of the HTTP spec - 15.1.3 Encoding Sensitive Information in URI's.
The only thing you can do is put a disclaimer on your site to say it doesn't work over https.
Since it is Google, it is not possible because there is not shared link with your website.
Once you are on HTTPS - it does not allow sending of REFERRER headers. I am sure you are aware that headers can be manipulated and cannot be trusted but, you may trust Google. However, due to privacy policy any activity done on Google by Google users are not shared by 3rd party. Link
Again, in server side languages you can find functions for HTTP Referrer but not HTTPS referrer. That is for a reason !
Unless and until you do not have a collaboration with the originating server who may create an exception in their RFC thing to allow HTTP REFERRER ONLY for your website. It isn't possible.
Hope that helps! (in moving on) :)
EDIT: Wikipedia Link See Referrer Hiding (2nd last line)
To see the referrer data you need to be either a paying google ads customer (and the visitor come via an ad-click) or have your site in HTTPS as well. Certs are cheap these days or you could use an intermediary like CloudFlare to do the SSL and have a self-signed cert on your site.
You can also see queries no matter the method used, with Google Webmaster tools.
I wrote a little about this here: http://blogs.dixcart.com/public/technology/2012/03/say-goodbye-to-keyword-tracking.html

How to get referral site URL?

I have posted my site URL on Facebook. Now I am coming to my site after clicking the link shared on Facebook. I want to capture the Facebook URL from where I am coming to my site. I want to get the referral site URL in my webapplication.
How do I get the referral site URL using C#?
You can use:
Request.UrlReferrer
More information on MSDN though I suspect there may be issues getting the referrer from Facebook, since FB connections are generally HTTPS and I'm pretty sure you don't get referrer info from HTTPS connections.
Good luck :)

Redirecting Old Urls After Web Site Overhaul

We have a website which we recently migrated to ASP.NET MVC. All of the URLs are now different from the original website. Google still has all of our old URLs, so if anyone finds us in a search, currently they will get a 404.
I have a catchall route that catches bad URLs, including all of the old ones. In a perfect world I would like to do a 301 redirect to the home page for all urls matching this catchall route, and I do have code for this that works properly on my development machine. However, I finally got someone at our ISP (Network Solutions) to tell me that they block 301 redirections (the web server returns a 404 instead).
So I think my only remaining option is to just accept any bad URL, and point it to the home page.
Here is my question: I know that the search engines (especially Google) are now penalizing duplicate content. If I just point all bad URLs to the home page, how much is this going to hurt us in the search rankings? Do I have any other technical options?
Honestly, I would suggest that you change ISP's. 301's are an important tool in any webmaster's toolbox, and for them to block that will penalize you terribly. You could easily transfer your domain to another IP address, wait for the DNS propagation, and then do your rollout.
From Google's Webmaster tools:
Use a 301 Redirect to permanently
redirect all pages on your old site to
your new site. This tells search
engines and users that your site has
permanently moved. We recommend that
you move and redirect a section or
directory first, and then test to make
sure that your redirects are working
correctly before moving all your
content.
Don't do a single redirect directing
all traffic from your old site to your
new home page. This will avoid 404
errors, but it's not a good user
experience. It's more work, but a
page-to-page redirect will help
preserve your site's ranking in Google
while providing a consistent and
transparent experience for your users.
If there won't be a 1:1 match between
pages on your old site and your new
site (recommended), try to make sure
that every page on your old site is at
least redirected to a new page with
similar content.
I'm sure that's much easier said then done, but I would never want an ISP that exerted that kind of filter against their clients.
Can you do a 302 redirect at least? I do agree with what womp says though, what ISP would block 301 redirects? Dump them. ISPs are a dime a dozen.
I completely agree with womp. I cannot believe that an ISP would block 301's.
I was so surprised that you can't do a 301 redirect on Network Solutions, because they're not exactly a two bit operation.
Their own marketing material suggests that you can. There's also a forum post by someone wanting to do a 301 redirect. Although they use a .htaccess, the reply from a Network Solutions tech support shows the user how to do a 301 redirect in ASP.
If you opt to not change ISP then the simples solution is to display a page where you say that the page has been moved with a link to the new page link, then you add a 5 second delay that re-directs using a HTML meta tag:
<html>
<head>
<title>Page moved</title>
<meta http-equiv="refresh" content="5;url=http://example.com/newurl">
</head>
<body>
The page has been moved, click here if you have not been re-directed to the new page within 5 seconds.
</body>
</html>
Alternatively you could use a URL rewriter, that way the old url "points" to the new page, there are basically two ways of doing this, the programmatically way is to create your own VirtualPathProvider, the second way is to use a URL Rewriter module like the IIS Url Rewrite Module.

Categories