Shorten the URL Routing code

1 posts, 0 answers
  1. L
    L avatar
    298 posts
    Member since:
    Apr 2008

    Posted 20 Sep 2012 Link to this post

    hi
    I hope you could help me on this.

    This is my sample:

    routes.MapPageRoute("template1", "{name}/template1", "~/area/template1.aspx")
    routes.MapPageRoute("template2", "{name}/template2", "~/area/template2.aspx")
    routes.MapPageRoute("template3", "{name}/template3", "~/area/template3.aspx")
    routes.MapPageRoute("template4", "{name}/template4", "~/area/template4.aspx")
    routes.MapPageRoute("template5", "{name}/template5", "~/area/template5.aspx")
    routes.MapPageRoute("template6", "{name}/template6", "~/area/template6.aspx")
    routes.MapPageRoute("template7", "{name}/template7", "~/area/template7.aspx")
    routes.MapPageRoute("template8", "{name}/template8", "~/area/template8.aspx")
    routes.MapPageRoute("template9", "{name}/template9", "~/area/template9.aspx")
    routes.MapPageRoute("template10", "{name}/template10", "~/area/template10.aspx")
    routes.MapPageRoute("template11", "{name}/template11", "~/area/template11.aspx")
    routes.MapPageRoute("template12", "{name}/template12", "~/area/template12.aspx")

    I have a problem here is that whenever i add a new template say template13.aspx, i would need to add a new line into my global file.

    Is there a way that i could just shorten it that represent everything? Thanks a lot

Back to Top