This topic is locked

Windows Authentication

11/8/2007 7:48:16 AM
ASPRunnerPro General questions
N
NigelEtienne author

I am trying to use windows authentication to bipass the login.ASP screen.
I have created an Active Directory with the users logins and the groups they belong to i.e. USER, MANAGER etc. I have deselected the Anonymous access check box and selected Integrated Windows Authentication on the Directory security.
I have added the code snippet

[left]if Request.ServerVariables("LOGON_USER")<>"" then

SESSION("UserID") = Request.ServerVariables("LOGON_USER")

SESSION("AccessLevel") = ACCESS_LEVEL_USER

Response.Redirect "Menu.asp"

end if

[/left]In the LoginOnLoad event as suggested in an earlier topic.
I am still getting the Login.ASP screen.
Any suggestions gratefully received.

Sergey Kornilov admin 11/8/2007

The code itself looks good.
I'd suggest to print Request.ServerVariables("LOGON_USER") variable on the web page to make sure it's populated.
Response.Write Request.ServerVariables("LOGON_USER")

N
NigelEtienne author 11/9/2007

The code itself looks good.

I'd suggest to print Request.ServerVariables("LOGON_USER") variable on the web page to make sure it's populated.
Response.Write Request.ServerVariables("LOGON_USER")


Sergey

Many thanks for the response.
Just to clarify I am using ASPRunnerPro 5.1 build 327 and I have added the event into \Output\Include\Events.ASP
I added Response.Write Request.ServerVariables("LOGON_USER") to the "LoginOnLoad" event and it did not display anything, however when I created a new event "BeforeProcessLogin(dbConnection)" the correct userID was displayed on the login page.

Sergey Kornilov admin 11/9/2007

I guess it's safe to use BeforeProcessLogin event for this purpose.

N
NigelEtienne author 11/12/2007

Sergy

Many thanks for the help, auto login now working. Here is the code
sub BeforeProcessLogin(dbConnection)

[color=#008000]'Our system always puts the domain at the start of the UserID so I used the code right(Request.ServerVariables("LOGON_USER"),8)" to restrict the text string to the last 8 characters i.e just the UserID.

SESSION("UserID") = right(Request.ServerVariables("LOGON_USER"),8)

SESSION("AccessLevel") = ACCESS_LEVEL_USER

'Replace X or Y with Valid User Id's

If session("UserID")="" then

[color=#008000]'Replace MyMenu and MyTask_List with page you want to display

Response.Redirect ".asp"

else

Response.Redirect "[color=#0000ff]MyTask_List.asp"

end if

End Sub

[/color]

N
NigelEtienne author 2/22/2008

Sergy

Many thanks for the help, auto login now working. Here is the code
sub BeforeProcessLogin(dbConnection)

[color=#008000]'Our system always puts the domain at the start of the UserID so I used the code right(Request.ServerVariables("LOGON_USER"),8)" to restrict the text string to the last 8 characters i.e just the UserID.

SESSION("UserID") = right(Request.ServerVariables("LOGON_USER"),8)

SESSION("AccessLevel") = ACCESS_LEVEL_USER

'Replace X or Y with Valid User Id's

If session("UserID")="" then

[color=#008000]'Replace MyMenu and MyTask_List with page you want to display

Response.Redirect ".asp"

else

Response.Redirect "[color=#0000ff]MyTask_List.asp"

end if

End Sub

[/color]



<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=26183&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />

I have just loaded the latest version of ASPRunnerPro build 391 and now the autologin seems to be ignoring the ASP user security settings i.e. autologin runs and redirects to appropriate page but then users cannot see data specifically assigned to them - they get the "no records" message displayed.

I have set the security setting for the MyDetails page as "Users can see and edit their own data only" with Users TableID: OwnerID Field = Login and Main Table: OwnerID Field = Login (where login = their network login ID).

I have changed the event from BeforeProcessLogin(dbConnection)

to LoginOnLoad - same result.

If I remove the LoginOnLoad event all security settings work correctly.

Any ideas on what is causing this conflict?

Regards

Nigel