I want to rewrite URL in an asp.net site
What i need is i don't want the user to see in which language the site was created
i.e it should not have www.examplesite.com/index.aspx as address 
instead i want it as www.examplesite.com/index
I don't want the user to see the extension of files
If this question is not related to Stackoverflow please redirect this question to the respective site of Stack Exchange.
Any help is appreciated.
You can do this at a simple level in the Global.asax file like this:
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
    ' Fires at the beginning of each request
    Dim path As String = HttpContext.Current.Request.Path
    If path.ToLower.EndsWith(".aspx") Then
        path = path.Substring(0, path.Length - 5)
        Response.Redirect(path, True)
    Else
        path += ".aspx"
        Context.RewritePath(path)
    End If
End Sub
If you have other files that are requested such as .png files, you may need some additional logic to filter these out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With