Process URLs and redirect?

  • Thread starter Thread starter r
  • Start date Start date
R

r

Hi all
I want to process all of urls of mysite.
for instance I have a site named www.example.com
when user enters xxx.example.com or www.example.com/yyy/ or anything
related to my site be processed by my handler and then be redirected to
proper page..
thanks in advance
 
try using the Application_BeginRequest event in global.asax

you can get all the parts of the url like this


Dim url As Uri = Request.Url
Dim scheme As String = url.Scheme
Dim host As String = url.Host
Dim pathQuery As String = url.PathAndQuery

and to be search engine friendly use 301 redirects


Response.Status = "301 Moved Permanently"
Response.AddHeader("Location", newUrl)
 
Back
Top