I am trying to do the following in my Global.asax file:
At the moment i have to define my route like this:
routes.MapPageRoute(
"ViewPage",
"pages/{slug}",
"~/viewpage.aspx",
false
);
Notice the word pages before the {slug}
Now if i define it like this:
routes.MapPageRoute (
"ViewPage",
"{slug}",
"~/viewpage.aspx",
false
);
It does not work.
My CSS and JS files wont load, i get a 404.
But, if i do this:
routes.MapPageRoute (
"ContactPage",
"contact",
"~/contact.aspx",
false
);
It works fine??
Basically i want my urls to look like this:
example.com/contact
or example.com/about-us
and it is all served dynamically from the database based on the {slug}.
Can anyone help?