Question

my question is simple and is probably asked, i have a website www.alovine.com and have a url www.alovine.com/registration.aspx. now i want people to be able to open the page when they type www.alovine.com/registration i.e. without the ".aspx" in the end.

i have searched for it and could not find the answer. i have tried changing in webconfig using this:

<rule name="Rewrite ASPX">
    <match url="registration" />
    <action type="Rewrite" url="registration.aspx" />
  </rule>
Was it helpful?

Solution

Insert this code on your Global.asax:

routes.MapPageRoute("", "{registration}", "~/registration.aspx");

With the above code, your link would look like:

http://localhost:12345/alovine/registration

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top