Auto group page-redirect

He has: 183 posts

Joined: Nov 2003

Hi, i have an access group, with a username and password login. I would like, if the user is in lets say an Staff access group then it will only show links which is avaible for staff only or it tranfers them to a new page only for the there access group. Can that be done.

E.g
Username Group Password
Darren Staff 123890
Bob Tech 123890

Staff will load up stafwelcome.asp
Tech will load up techwelcome.asp

It is only a few links which i have on a page which i dont want some users to see. for example if i dont want them to see the create new user hyper link.

Thanks

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Sure that can be done.

Set session variables and use conditional includes based on those session variables.

Edit: oh, I don't know if asp has session variables? It must, though.

He has: 183 posts

Joined: Nov 2003

It does, but not 100% on how to set it up, but if that is the way, then i will try it out. thanks for the quick response

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

ASP has a Session object...

'login.asp

If Request("txtUser") = "staff" And Request("txtPass") = "secret" Then
    Session("IsStaff") = True
    Response.Redirect "staffwelcome.asp"
EndIf

If Request("txtUser") = "staff" And Request("txtPass") = "secret" Then
    Session("IsTech") = True
    Response.Redirect "techwelcome.asp"
EndIf

Session("IsStaff") = False
Session("IsTech") = False
Response.Redirect "guestwelcome.asp"
'
'staffwelcome.asp

If Session("IsStaff") = False Then
    'quit hacking!
    Response.Redirect "login.asp"
EndIf
'

Mark Hensler
If there is no answer on Google, then there is no question.

He has: 183 posts

Joined: Nov 2003

Hi, thanks for that Mark. It work a treat. Just to let you no, the above code does not show up on Mac OS X on IE. Lucky that i have a PC along side me.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

dhotchin wrote: Just to let you no, the above code does not show up on Mac OS X on IE.

heh, I was about to say that...

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Really?! That's the default vB template for the code tag. How could they have missed that?!!

He has: 183 posts

Joined: Nov 2003

Hi, i have not really study ASP. I have only learnt using Dreamweaver. So it does that coding in the background. I have learnt the main errors which could could happen and how to fix them. Just not another sort of coding. So i'm learning all the time. Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

shows up fine in Safari. Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.