Forms authentication: how to redirect unauthorized users?

B

BJ Lap

Hi,

I implemented forms authentication in my web site.
This works fine but for one thing:
If an authenticated user tries to navigate to a page for which this user has
no access,
(this is specified in web.config files in several directories in the web
site), the user is redirected to the logon page. But I want the user to be
redirected to an 'acces denied' page. How can that be accomplished?

Thanks,
Bert-Jan
 
B

Brock Allen

You need to check on your login page to see if Request.IsAuthenticated. This
will tell you they've been redirected and they're already logged in. You
can then let them know they've tried to access a page that they don't have
access to.
 
B

BJ Lap

Thanks! This works fine now.
Bert-Jan

Brock Allen said:
You need to check on your login page to see if Request.IsAuthenticated.
This will tell you they've been redirected and they're already logged in.
You can then let them know they've tried to access a page that they don't
have access to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top