Reputation: 20120
if the user 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 website (including url) but without having to make physical file
this would be one file
http://myweb/acceuil.aspx
http://myweb/home.aspx
Upvotes: 2
Views: 1914
Reputation: 21117
Not sure what you are trying to do, but this is the best turtorial for the question you asked:
How to: Use Routing with Web Forms
Upvotes: 3
Reputation: 180808
That's not routing; that is a redirect.
_rick_shott
seems to have the mojo on routing bad urls into a 301 redirect. I upvoted his answer. You should check out his HTTPModule solution.
Upvotes: 1
Reputation: 7484
In your web.config, add a customErrors and error node as follows:
<customErrors mode="On" defaultRedirect="ErrorDisplayPage.aspx">
<error statusCode="404" redirect="http://myweb/site.aspx"/>
</customErrors>
This will displayErrorDisplayPage.aspx for all unmanaged errors except for 404 errors (which are "page not found"). For 404 errors, the browser will redirect to the site.aspx page.
Upvotes: 0