This is because ASP.NET does not know how to handle .html pages.
IIS will handle .html pages by itself without involving ASP.NET.
You need to add handler mapping in IIS for html pages to solve this issue.
Follow these steps.
In IIS rightclick your website/virtual directory --> properties --> home directory/virtual directory tab --> "configuration" button under the "application settings" section --> Add the mapping for html pages.
OR
In IIS rightclick your website/virtual directory --> properties --> custom errors tab --> set the 404 error to the page your error page.
what exactly is "not working for you" w/ the 401 error? perhaps you're still logged in, or perhaps you are using cookies w/ forms auth and you still have the cookie, therefore you're technically authorized, you being the admin.
Please post your code for us to help!!
Mark Answered if it helps - Good luck!
Cheers!
Design And Align - Rob
bin hex
Member
2 Points
25 Posts
Custom error page???
Apr 10, 2012 12:45 PM|LINK
Hi,
I am trying to implement custom error page using Web.config file, but it never works for me...
<customErrors defaultRedirect="http://127.0.0.1:82/web/Error.html" mode="On">
<error statusCode="401" redirect="http://127.0.0.1:82/web/unauthorised.html"/>
<error statusCode="404" redirect="http://127.0.0.1:82/web/404.html"/>
</customErrors>
What might be the error?
Rajneesh Ver...
All-Star
37350 Points
6840 Posts
Re: Custom error page???
Apr 10, 2012 12:53 PM|LINK
Try as below:
<customErrors mode="On" defaultRedirect="Error.html"> <error statusCode="401" redirect="unauthorised.html" /> <error statusCode="404" redirect="404.html" /> </customErrors>www.rajneeshverma.com
Keep Forums Clean || Use Alert Moderators.
robwscott
Star
8079 Points
1491 Posts
Re: Custom error page???
Apr 10, 2012 12:54 PM|LINK
perhaps the ip isn't correct or can't find it. use relative path instead
<customErrors mode="On" defaultRedirect="~/web/error.html"> <error statusCode="404" redirect="~/web/404.html" /> </customErrors>Mark Answered if it helps - Good luck!
Cheers!
Design And Align
- Rob
bin hex
Member
2 Points
25 Posts
Re: Custom error page???
Apr 10, 2012 01:03 PM|LINK
its working for 404 not found...but it doesnt work for unauthorized error...
server says 401.0 Unauthorized with server Default error page...but it doesnt show the custom one....
avinash_bhud...
Contributor
2881 Points
517 Posts
Re: Custom error page???
Apr 10, 2012 01:05 PM|LINK
This is because ASP.NET does not know how to handle .html pages.
IIS will handle .html pages by itself without involving ASP.NET.
You need to add handler mapping in IIS for html pages to solve this issue.
Follow these steps.
OR
bin hex
Member
2 Points
25 Posts
Re: Custom error page???
Apr 10, 2012 01:05 PM|LINK
Rajneesh,
My error pages are in "web" folder under root then how can i simply mention it simply with filename?
bin hex
Member
2 Points
25 Posts
Re: Custom error page???
Apr 10, 2012 01:07 PM|LINK
robwscott,
IP is correct only...404 is working fine...problem with unauthorized error page....
bin hex
Member
2 Points
25 Posts
Re: Custom error page???
Apr 10, 2012 01:09 PM|LINK
But it is working for 404 not found error...
amitpatel.it
Star
7966 Points
1865 Posts
Re: Custom error page???
Apr 10, 2012 01:16 PM|LINK
Here you can find complete error handling mechinsum including custom error page and error log.
http://amitpatelit.com/2011/04/05/error-handling-mechanisms-in-asp-net-application/
MCPD Enterprise and Web Application
MCTS Web, Window and Enterprise Application
robwscott
Star
8079 Points
1491 Posts
Re: Custom error page???
Apr 10, 2012 01:28 PM|LINK
what exactly is "not working for you" w/ the 401 error? perhaps you're still logged in, or perhaps you are using cookies w/ forms auth and you still have the cookie, therefore you're technically authorized, you being the admin.
Mark Answered if it helps - Good luck!
Cheers!
Design And Align
- Rob