Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
<%#If(Eval("PlanTitle") = "Free", "", "Website")%>




In global page(vb code)

Imports System.Web.SessionState
Imports System.IO

Public Class Global_asax
Inherits System.Web.HttpApplication

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request

Dim physicalPathVar As String = Request.PhysicalPath.ToString()

'Response.Write(physicalPathVar + " - in Index");
'return;
If File.Exists(physicalPathVar) Then
' Do nothing here, just serve the file
'Response.Write(physicalPathVar + " - in Else part 0");
' If the file does not exist then
ElseIf Not File.Exists(physicalPathVar) Then
'Response.Write(physicalPathVar + " - in Else part 1");
' Get the URL requested by the user
Dim sRequestedURL As String = Request.Path
Dim sTargetURL As String = ""


If sRequestedURL.Contains("business/") Then

Dim _location As Integer = sRequestedURL.LastIndexOf("/")

sRequestedURL = sRequestedURL.Substring(_location + 1)
' check if the URL is well formed

'*********** Sonu testing *end ***************
sTargetURL = Me.convertRssURL(sRequestedURL)

Else
' as more modules are added so will the checks here
'Response.Write(physicalPathVar + " - in Else part 4");
sTargetURL = "Default.aspx"
End If
'Response.Write(physicalPathVar + " - in Else part 5");
Context.RewritePath(sTargetURL, False)
'Response.Write(physicalPathVar + " - in Else part 6");
End If

End Sub

Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires upon attempting to authenticate the use
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub

Public Function convertRssURL(ByVal URLToProcess As String) As String

Dim finalURL As String = ""

If URLToProcess.Length > 0 Then

finalURL = "~/ViewExternalWebSite.aspx?id=" + URLToProcess
Else

finalURL = "/"
End If

Return finalURL
End Function


End Class

My original url -: ViewWebsite.aspx?id=41
i have completed change url
ViewWebsite.aspx?id=41 to
business/username/41

But now any other link click in this page then exception why?
My url has been caught (business)
Posted
Comments
Sergey Alexandrovich Kryukov 10-Jul-14 11:25am    
Why not using the debugger? If you just have an unexpected exception you can always reproduce, this situation is already simple enough.
Note that you did not present any exception information, which should include: type, message, stack, inner exception (recursively), if any.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900