Hi,
how to change extension in address bar is like a .aspx, ascx
where can add code???
How to change extension in address bar is like a .aspx, ascx
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Nitesh KejriwalRank #253 · 9.9K reputationPosted Nov 1, 2012, 2:00 PM EDT
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