I need a simple asp.net routing example

if custom type

http://myweb/mysite.aspx (file does not exist)

      

I want them to go to

http://myweb/site.aspx (file does exist)

      

My goal is to make a bilingual site (including url), but without the need to make a physical file

it will be one file

http://myweb/acceuil.aspx
http://myweb/home.aspx

      

+2


source to share


3 answers


Not sure what you are trying to do, but this is the best tutorial for the question you asked:



How to use routing with web forms

+3


source


This is not routing; it's a redirect .



_rick_shott

seems to have a mojo for routing bad urls to a 301 redirect. I supported his answer. You should check out his HTTPModule solution.

+1


source


In your web.config add customErrors and node error like this:

    <customErrors mode="On" defaultRedirect="ErrorDisplayPage.aspx">
     <error statusCode="404" redirect="http://myweb/site.aspx"/>
    </customErrors>

      

This will displayErrorDisplayPage.aspx for all unmanaged errors except 404 errors (which are not displayed on the page). For 404 errors, the browser is redirected to the site.aspx page.

0


source







All Articles