E
Eric Lemmon
Greetings,
I wrote code to handle vanity URLs, so--for example--the URL
http://localhost/myApp/bsmith.aspx is internally translated to
http://localhost/myApp/Support/UserPage.aspx?user=bsmith.
The problem is that whenever I access the vanity URL,
http://localhost/myApp/bsmith.aspx, the page shows without any CSS
styles...quite ugly. However, when I get to the page directly using its
actual address, http://localhost/myApp/Support/UserPage.aspx?user=bsmith, it
displays fine.
Does anyone know what I'm doing wrong? (The Global.asax.vb code is below)
Thank you!
Eric
'\\\
' NOTE: This code assumes "Imports System.IO"
Sub Application_BeginRequest(ByVal sender As Object, _
ByVal e As EventArgs)
' Fires at the beginning of each request
Dim strPageOwner As String
Dim strCurrentPath As String
Dim strCustomPath As String
strCurrentPath = Request.Path.ToLower
With strCurrentPath
' Make sure the request is for the vanity URL, where it is an
' aspx page in the root directory, and it is not Default.aspx.
If .IndexOf("default.aspx") = -1 AndAlso _
.IndexOf("/products/") = -1 AndAlso _
.IndexOf("/secure/") = -1 AndAlso _
.IndexOf("/support/") = -1 AndAlso _
.IndexOf("/about/") = -1 Then
strCustomPath = String.Format( _
"/myApp/Support/UserPage.aspx?user={0}", _
Path.GetFileNameWithoutExtension(Request.Path))
Context.RewritePath(strCustomPath)
End If
End With
End Sub
'///
I wrote code to handle vanity URLs, so--for example--the URL
http://localhost/myApp/bsmith.aspx is internally translated to
http://localhost/myApp/Support/UserPage.aspx?user=bsmith.
The problem is that whenever I access the vanity URL,
http://localhost/myApp/bsmith.aspx, the page shows without any CSS
styles...quite ugly. However, when I get to the page directly using its
actual address, http://localhost/myApp/Support/UserPage.aspx?user=bsmith, it
displays fine.
Does anyone know what I'm doing wrong? (The Global.asax.vb code is below)
Thank you!
Eric
'\\\
' NOTE: This code assumes "Imports System.IO"
Sub Application_BeginRequest(ByVal sender As Object, _
ByVal e As EventArgs)
' Fires at the beginning of each request
Dim strPageOwner As String
Dim strCurrentPath As String
Dim strCustomPath As String
strCurrentPath = Request.Path.ToLower
With strCurrentPath
' Make sure the request is for the vanity URL, where it is an
' aspx page in the root directory, and it is not Default.aspx.
If .IndexOf("default.aspx") = -1 AndAlso _
.IndexOf("/products/") = -1 AndAlso _
.IndexOf("/secure/") = -1 AndAlso _
.IndexOf("/support/") = -1 AndAlso _
.IndexOf("/about/") = -1 Then
strCustomPath = String.Format( _
"/myApp/Support/UserPage.aspx?user={0}", _
Path.GetFileNameWithoutExtension(Request.Path))
Context.RewritePath(strCustomPath)
End If
End With
End Sub
'///