[dba-VB] ASP.NET Redirect on 404 error

Salakhetdinov Shamil mcp2004 at mail.ru
Wed Sep 26 16:16:04 CDT 2012


Hi Gustav --

Just a note (I have no real life experience with cases as you have) - do you have ASP.NET routing enabled for your "human-friendly" URLs - the ones without .aspx extension?

http://stackoverflow.com/questions/3523264/asp-net-4-0-url-routing-http-error-404-0-not-found


Thank you.

-- Shamil


Wed, 26 Sep 2012 22:55:40 +0200 от "Gustav Brock" <Gustav at cactus.dk>:
>	
>
>
	
	
>
		
		
			
>Hi all
>
>
OK, I've made some progress - paying attention to Upper/lower case of Mode:
>
>
<configuration>
>
    <system.web>
>
      <compilation debug="true" targetFramework="4.5" />
>
      <httpRuntime targetFramework="4.5" />
>
      <customErrors mode="On">
>
        <error statusCode="404" redirect="Default.aspx" />
>
      </customErrors>
>
    </system.web>
>
</configuration>
>
>
Now a not-found page like:
>
>www.example.com/somewrongpage.aspx
>
>
is redirected. But:
>
>www.example.com/somethingwrong
>
>
still fails with 404.
>
>
Any hints?
>
>
/gustav
>
>
>
>>> gustav at cactus.dk 26-09-12 17:43 >>>
>
Hi all
>
>
I have an extremely simple site, one page only: Default.aspx
>
>
How can I in a simple way redirect all faulty URLs to this page? So that if the user types:
>
>www.example.com/somethingwrong
>
>
the error is trapped and the user gets:
>
>www.example.com/Default.aspx
>
>
I have this Web.config file which should do the job, but it doesn't:
>
>
<configuration>
>
    <system.web>
>
      <compilation debug="true" targetFramework="4.5" />
>
      <httpRuntime targetFramework="4.5" />
>
      <customErrors Mode="On">
>
        <error statusCode="404" redirect="Default.aspx" />
>
      </customErrors>
>
    </system.web>
>
</configuration>
>
>
Aside from this I can google many fancy solutions. Not needed. It just needs to call the default page.
>
>
/gustav
>
>
>
_______________________________________________
>
dba-VB mailing list
>dba-VB at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-vb
>http://www.databaseadvisors.com
>
>
			
		
		
	

	


More information about the dba-VB mailing list