Forms authentication: how to redirect unauthorized users?

  • Thread starter Thread starter BJ Lap
  • Start date Start date
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
 
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 

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

Back
Top