c# - URL routing turning /pages/test.aspx into /test -


i made folder called 'pages' in asp web forms project. in folder have lot of pages:

  • test.aspx
  • hello.aspx

when open these pages in browser get:

  • www.domain.com/pages/test.aspx
  • www.domain.com/pages/hello.aspx

this normal, know. if want delete /pages in url , show (without .aspx):

  • www.domain.com/test*.aspx*
  • www.domain.com/hello*.aspx*

i can manually adding new route (in registerroutes() method) each page there way dynamicly?

i found question don't know if can use problem. webforms custom / dynamic routing

try this, not sure if it. put pages in root directory. think work.

source link: http://msdn.microsoft.com/en-us/library/vstudio/cc668177(v=vs.100).aspx

routes.mappageroute("pageroute","{page}", "~/pages/{page}.aspx"); 

not sure if that's looking for, way can like:

response.redirecttoroute("pageroute", new { page = "test" }); 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -