Replacing "http://www.mysite.com/" with "http://www.mysite.com/DefaultPage.aspx" ?

Hello,

If I go to a web site with a default page set, the name of the page is not shown in the URL, which is a correct behaviour. The problem is that I can't detect this page as a referrer after going to some other page. Is there a solution for this? Can I find a referrer even in case of the default page? Or can I use URL rewriting to modify the URL to always show the default page? If I can, how?

Thanks for any help,
Radoslav



 

0
Radoslav
8/31/2007 10:20:00 AM
asp.net.handlers-modules 2116 articles. 0 followers. Follow

4 Replies
446 Views

Similar Articles

[PageSpeed] 44

 Hi,

Look at my answer in this topic.

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


Zafar Iqbal
VP Technology
Hansvits


** Please mark as ANSWER if my reply helped you
0
ziqbalbh
8/31/2007 1:26:21 PM

The code runs at ISP's so I don't have any permissions to make any changes in IIS config.
Maybe URL rewriting would solve my problem?

0
Radoslav
8/31/2007 4:19:02 PM

You can rewrite in global.asax. There are many ways of doing it. Here is one of them:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)

Dim context As HttpContext = HttpContext.Current

If context.Request.Url.ToString.ToLower = "http://www.chapterzero.co.uk" Then

       HttpContext.Current.Response.Status = "301 Moved Permanently"

       HttpContext.Current.Response.AddHeader("Location", "http://www.chapterzero.co.uk/default.aspx")

Response.End()

End If

End Sub

0
BalochDude
9/4/2007 8:22:08 AM

-- OR --

If (HttpContext.Current.Request.Url.ToString().ToLower().EndsWith("/")) Then

HttpContext.Current.Response.Status = "301 Moved Permanently"

HttpContext.Current.Response.AddHeader("Location", Request.Url.ToString().ToLower() & "default.aspx")

End If

0
BalochDude
9/4/2007 8:29:34 AM
Reply: