Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

clean urls using routing

$
0
0

hello,

i am trying to achieve clean urls in my web application but have not been able to find a solution using the routing techniques discussed in this msdn link:

http://msdn.microsoft.com/en-us/library/cc668177(v=vs.100).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1

i would like all the edits to be in the Global.asax.vb file.  when i use the following code, the url remains in its long form, unchanged.

Global.asax.vb:

Imports System.Web.Routing

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RegisterRoutes(RouteTable.Routes)
End Sub

Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.MapPageRoute("Contact", "Products/Contact", "~/Products/ContactEntry.aspx")
End Sub


this code runs with no errors, however, when i click on a link that uses the  "~/Products/ContactEntry.aspx", the page loads and the url in the address bar remainshttp://<domain>/Products/ContactEntry.aspx.  i was expecting to seehttp://<domain>/Products/Contact (a cleaner url).

am i missing something obvious?

thanks!

 


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>