Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 775
gunwin Avatar asked Dec 25 '11 10:12

gunwin


1 Answers

You can get the path entered in the user's browser with:

string path = Request.RawUrl;

MSDN

like image 155
Nick Butler Avatar answered Oct 08 '22 11:10

Nick Butler