How to tell if a user is visiting "/Default.aspx" or just "/"

.net, asp.net, c#, c#-4.0

Solution

If it's just SEO you are concerned about, then you can use the the canonical "tag".

If you place this in your Default.aspx page:

<link rel="canonical" href="http://www.mysite.com/" />

Google will always index

http://www.mysite.com/Default.aspx

as

http://www.mysite.com/

preventing both pages being indexed and competing in the search results.

You can read more here: http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

Problem

I am writing in the Application_BeginRequest part of my Global.asax.cs. For SEO purposes, I'm trying to redirect users that are looking at: ``` http://www.example.com/Default.aspx ``` to: ``` http://www.example.com/ ``` My question is: How can I tell which the user is looking at? I've been using: ``` HttpContext.Current.Request.Url.* ``` But all the parameters are identical regardless of which one I am visiting.

Original source

Related problems