i have set up different folders which can only be accessed by specified roles like admin/customer/employee.
now whenever a user click on a button that redirects to a page where he doesnt have an access to, an error page comes up.
now how do i fix that to redirect to my own error page?
in short heres what i want do to
if access fails {redirect to my custom page instead of the error page}.
thanks in advance.
Loading
Mark UyPosted Dec 4, 2009, 10:33 AM
its working and working. thanks to you man!
Kirtan PatelPosted Dec 4, 2009, 10:05 AM
you have only Set Error Page for One Type of Error its "when User Have no Access" to folder but if you want to see Custom Error page For Other Error Also then You need to Set Error pages For Other Types f Error Also Like page for 404 error etc
Mark UyPosted Dec 4, 2009, 9:55 AM
the error page still says something like this:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.Requested URL: /TRANE ver.27/Internal/service_request.aspx
instead of redirecting to my error page which is testerror.htm.
is the try catch sequence applicable here? if so can anybody guide me?
Kirtan PatelPosted Dec 4, 2009, 9:14 AM
Set Mode="On" in that CustomError Section of Web.config then it will show you custom error page on your local computer and RemoteComputer Both.
As when you set the Mode ="RemoteOnly" it will show custom error page only when its on webserver .
and check "Do you like this answer" check box if it helps you :)
Thanks :)
Mark UyPosted Dec 4, 2009, 8:57 AM
Kirtan PatelPosted Dec 4, 2009, 8:16 AM
In your Web.Config that is In Root Folder of Site See in "custom error " section.
see in Below Image (look the line i have highlighted ) just set path of your custom html
page that you want to show instead of NoAccess.html error page .also you have to Un-Comment that custom error part in web.config by removing "-->" and " agoPosted Dec 4, 2009, 7:19 AM
In order to do custom error handling you can use either your web config file or your global.asax
The easiest in my opinion is the web config..
basically you just have to add the tag with the status code of the error and the url of the page you want to redirect to.
Read this article it will have the full details on how you can do this.
http://www.15seconds.com/issue/030102.htm