Search code examples
c#asp.netformsauthentication

Transfer instead of redirect to login in forms authentication


I give to google a sitemap with all my pages, when the crawler tries to access them he gets redirected to the login page.

In the login page I write an explanation of what the page does so the crawler can see that each page is different.

The problem now is that the bot is clever enough as to recognize that it is a redirect:

URLs not followed When we tested a sample of URLs from your Sitemap, we found that some URLs redirect to other locations. We recommend that your Sitemap contain URLs that point to the final destination (the redirect target) instead of redirecting to another URL. HTTP Error: 302

If instead of using a redirect in RedirectToLoginPage(String), Microsoft had used a Server.Transfer, google would never find out it is actually the same page.

Any Ideas?


Solution

  • Okey I found a not elegant solution, but it suits my needs:

    http://forums.asp.net/t/1358997.aspx

    ""For now, I found a workaround: I capture the End-request event and see if the status code is "302 redirected"; if it is, I'll just alter the address from there and do whatever I need to do. Not the most elegant solution (and requires more processing for every page request; not just login redirects), but at least it works.""