Process URLs and redirect?

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
 
T

ThatsIT.net.au

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Relative URLs 6
URLs, 404 redirect etc. 5
URLs 5
Page redirect 1
Redirect url website 2
URLs and Paths and stuff 2
Protect / Authorize urls. 0
https and relative urls 2

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top