views:

37

answers:

1

Hello friends,

I am using following setting for customError.

< customErrors mode="On" defaultRedirect="GenericErrorPage.aspx" > < error statusCode="403" redirect="NoAccess.aspx" /> < error statusCode="404" redirect="FileNotFound.aspx" /> < /customErrors>

I have a folder "Admin" having access to administrators role. When someone other than administrators tries to access the pages inside admin folder, it is redirected to login page. My expectation is to display "NoAccess.aspx".

Whats wrong with this code? Or is there other meaning to statusCode=403.

Could someone provide help on this.

Thanks for sharing your valuable time.

+1  A: 

If you're using IIS 7 then the error pages should be set here:

UPD: Ok, after reviewing the question I realised that the problem is in something else.. By default the authentication system in ASP.NET redirects all 403 requests to the login page. This is the way it's coded, and yes, it ignores the we.config settings.

There are solutions, of course.. You can check an example of how it was solved here ( similar question of SO ) http://stackoverflow.com/questions/1847099/with-asp-net-membership-how-can-i-show-a-403

Good luck!

Artiom Chilaru
thanks Artiom! but i m using IIS6.
IrfanRaza
Sorry, updated the answer with the correct solution.
Artiom Chilaru
Thanks again Artiom! I will check for this and reply soon.
IrfanRaza