asp.net - Using a constant string in URL using url Rewriting or Routes -


i have asp.net website should have variable string in url.

the content of website changes depending on year. idea have year in url in clean way.

http://localhost/year/index.aspx 

i have done in mvc routing, have no idea how in asp.net. need 1 route guess. url's before (index.aspx, ...)

basically in stead of having ?year=2011 behind every url in website i'd have value in route.

how , should use that? rewriting or routes?

have here http://urlrewriter.net/

download assembly, add reference in project.

in web.config file in configsections element add this

<section name="rewriter" requirepermission="false" type="intelligencia.urlrewriter.configuration.rewriterconfigurationsectionhandler, intelligencia.urlrewriter"/> 

create 1 more section

<rewriter>     <rewrite url="http://localhost/(.*).aspx" to="http://localhost/index.aspx?year=$1"/> </rewriter> 

try content need http://localhost/2011.aspx

i hope helps


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -