DotNetBlocks
Programmer
Hello,
I am realy stuck. I am having a problem with the HttpContext.Current.RewritePath in "Global_BeginRequest". When i try and call a file i always get a 404, but i know thefile is there becuse if i switch to server.tranfer or response.redirect it works perfectly. Plus my path is relative to the root directory. I am so confused why this is not working. Any help would be greatly appreciated.
Here is my code. I am using VB 2003
Babloome
I am realy stuck. I am having a problem with the HttpContext.Current.RewritePath in "Global_BeginRequest". When i try and call a file i always get a 404, but i know thefile is there becuse if i switch to server.tranfer or response.redirect it works perfectly. Plus my path is relative to the root directory. I am so confused why this is not working. Any help would be greatly appreciated.
Here is my code. I am using VB 2003
Code:
Private Sub Global_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.BeginRequest
' Fires at the beginning of each request
Dim strUrl As String = Request.ServerVariables("URL")
If strUrl.EndsWith("/") Or strUrl.EndsWith("index.aspx") Then
Dim page As Integer = 1
If Request("page") <> "" Then
page = Request("page")
End If
With strUrl
Select Case True
Case .EndsWith(".asp")
Exit Sub
'Case .EndsWith(".aspx")
' Exit Sub
Case .EndsWith(".gif")
Exit Sub
Case .EndsWith(".html")
Exit Sub
Case InStr(Right(strUrl, 4), ".") = 0 Or .EndsWith("index.aspx")
HttpContext.Current.RewritePath("/CJ_API_Directory/test.aspx?page=" & page)
End Select
End With
End If
End Sub
Babloome