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

Comments

Popular posts from this blog

Executing PowerShell scripts from C#

HOW TO Use the NumericUpDown Control

Exposing Agile Software Development Myths