Hi,
how to change extension in address bar is like a .aspx, ascx
where can add code???
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nitesh KejriwalPosted Nov 1, 2012, 6:00 PM
1. If you are using IIS7.5+, you can configure this in IIS settings and this will need to be done for each page.
2. You can write below code in Global.asax page of the application in Application_BeginRequest(). The below code will redirect HTML pages to your ASPX pages.
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
If Request.PhysicalPath.ToLower().EndsWith(".html") Then
Context.RewritePath(Request.PhysicalPath.Replace(".html",".aspx), False)
End If
End Sub