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

HOW TO Use the NumericUpDown Control

How To Get IP & Locations details of client machine in asp.net

Get control name in Page_Load event after post back by any control