How to rewrite URL
Add this code in global.asmx page
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
If (Request.Path.Contains("part of url where you want to change")) Then
Try
Dim MyContext As HttpContext = HttpContext.Current
Dim URL As String = MyContext.Request.Path
//change your relevent url
MyContext.RewritePath(add new Url, True)
Catch ex As Exception
End Try
End If
End Sub
Protected Sub Application_BeginRequest(ByVal sender As Object, ByVal e As System.EventArgs)
If (Request.Path.Contains("part of url where you want to change")) Then
Try
Dim MyContext As HttpContext = HttpContext.Current
Dim URL As String = MyContext.Request.Path
//change your relevent url
MyContext.RewritePath(add new Url, True)
Catch ex As Exception
End Try
End If
End Sub
Comments
Post a Comment