PDA

View Full Version : Capture window logon users and set permission


jennypretty
03-16-2009, 03:30 PM
Hello,

I tried to capture three users who logged in the windows to give access to one specific ASP page. However, it didn't do anything. If I set for one user only, then it worked. But if I set for two users, it didn't work.

I like to give access to only these three users as below.

Here is my code:

<% Dim strLogon, strUser1, strUser2, strUser3
strLogon = Request.ServerVariables("Window_User")
strUser1 = user1
strUser2 = user2
strUser3 = user3

If strLogon <> user1 OR strLogon <> user2 OR strLogon <> user3 Then
Response.Redirect "error.asp"
End If
%>


If I do just one user, it worked. For two or three users, it didn't do it.

Can anyone please advice? What did i do wrong and how to make it work?

Thanks very much!

Spudhead
03-16-2009, 06:17 PM
I'm unaware of a server variable called "Window_User". Perhaps you're looking for "AUTH_USER"?

jennypretty
03-16-2009, 10:36 PM
Yes.
That's right.

Either of the User1, user2, and user3 can access the page, other people with user4, user5, or else, points to the error.asp page.

Thanks.

brazenskies
03-17-2009, 10:39 AM
would a case statement work in this situation?

select case theUser
case "user1"
response.write("Hello")
case "user2"
response.write("Hello")
case "user3"
response.write("Hello")
case else
response.write("Denied")
end select


You'll obviously need to change this a little to fit your code

jennypretty
03-17-2009, 04:44 PM
I worked perfect.
Thanks.

brazenskies
03-17-2009, 05:16 PM
no problem