Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > conditional redirects based on login status and other conditions

Reply
Thread Tools

conditional redirects based on login status and other conditions

 
 
Keith G Hicks
Guest
Posts: n/a
 
      03-06-2008
asp.net 2.0

I have a login control on a Login.aspx page. If a user tries to go to a page
and is not authenticated and should be then he's taken to the login page.
The login control has a property (DestinationPageUrl) for the page to go to
on successful login. But I need more than one destination depending on the
page that took the user to the Login page and where he may have been going
when the login page came up.

Examples:

1. If the user is on the default page and clicks the Login link then I want
him to be take back to the Default page.

2. If he clicks a link on the default page that is supposed to take him to a
page that requires authentication, then the login page should appear and
then after logging in correctly, he should continue on to the page desired.

I'm pretty sure that with little or no code, the login control handles the
above on it's own. However, there are other situations that I cannot seem to
solve and if htey are handled, probably negate the automated redirect stuff
that the login control does. Not sure though.

3. The user is not logged in and is on a page other than the default page
(ListOfPeople.aspx). This page does NOT require him to be logged in. There
is a link ("Edit my Info") on that page that takes the user to one of 2
pages that DO require him to be logged in. This one is a little complicated.
If the user is not logged in when he clicks the "Edit my Info" link, then he
needs to be taken to the login page. After logging in, one of 2 things
should happen. First, if he's previously located himself in a list of people
(whehter he has or not is stored in one of my sql tables), then he is taken
to page EditMyInfo.aspx but if he's not already found himself in the
listthen he's to be taken to FindMyself.aspx.

4. This is similar to item #3 except that he's already logged in. When the
user is on the ListOfPeople.aspx page, I still need to take him to the
EditMyInfo.aspx page or the FindMyself.aspx page depending on whehter or not
he's previouslly found himself in the list.

In either of situations 3 & 4, if he does not log in succesfully, he needs
to be take back to the Default.aspx page

I hope I explained this well enough. I'm not sure if all this has to happen
with Redirects in VB or if it can be done in another way. I'm also not sure
if I need to set session variables, query strings or something else to
indicate where the user came from and where he intended on goiogn so that
any If/Else/Endif VB code I write will cuase the user to end up in the right
place. I'm just not sure of the best way to handle this in asp.net.

Thanks,

Keith



 
Reply With Quote
 
 
 
 
Keith G Hicks
Guest
Posts: n/a
 
      03-07-2008
Well I ended up handling this with a combination of session variables and
query string variables. It seems to work fine so far. I'm still open to
ideas because I'm sure others have already created this wheel many times.
I'm far from an expert at this point so I'm sure I could be doing things
better.

Keith


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CreateUserWizard control redirects me to login.aspx Oleg ASP .Net Security 0 12-22-2008 08:34 PM
Please help! SecurityFilter redirects to login page again... Peet Java 0 06-28-2006 10:21 AM
SecurityFilter redirects to login page again... Peet Java 1 06-12-2006 12:54 PM
Help with code for conditional redirect based on ALIVE status andysideas@gmail.com Javascript 1 02-07-2006 04:43 PM
? ELSE Conditional Comment / Using Conditional Comments Inside Other Tags To Comment Out Attributes Alec S. HTML 10 04-16-2005 02:21 AM



Advertisments