This topic is locked

Redirect in LoginOnLoad does not execute

10/29/2007 3:33:50 PM
ASPRunnerPro General questions
C
C Sammet author

Ok, I have searched the forums and even some ASP forums. Here is my problem, which I can't seem to find an answer to, but that is probably something simple I am missing.
I have code that is set-up to simple use the Windows Logon name in place of forcing the User to login again in the ASP Runner app. It uses code like;
[indent]if Request.ServerVariables("LOGON_USER")<>"" then

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

SESSION("AccessLevel") = ACCESS_LEVEL_USER

Response.Redirect "..._list.asp"

end if[/indent]
Where it sets the USERID and then does a Response.Redirect.
The problem is that I have four different tables for which I have screens built. They all use the same exact code place in the LoginOnLoad Global Event. Two of the screens function as expected, while the other two for what ever reason do not. Through debugging I was able to determine that they all do execute the LoginOnLoad event and set the UserId, but for some reason two of them just won't do the redirect to the List screen and instead still go right into the Login screen. Actually it enters the Login.asp, fires the LoginOnLoad event and then even though there is a redirect it still loads and displays the Login screen and waits for input.
I have checked seurity, IIS settings, permissions, etc.... All are the same for all 4 apps. I just can't figure out what is wrong. They all use the same App Pool, so that doesn't seem like it could be an issue.
I have even tried putting a redirect at the beginning of the Login.asp file and it worked for a while, but then eventually it stopped working and caused a problem such that the Login.asp file wouldn't function at all.
So I am curious if anyone else has ever run into this before or if this is actually a purely ASP question and maybe I should address it in a different forum.
Any help whatsoever would be appreciated since I am at my whits end.

Sergey Kornilov admin 10/29/2007

I guess Request.ServerVariables("LOGON_USER") variable is not populated.
Try to print it on the login page.

Response.Write Request.ServerVariables("LOGON_USER")

Response.End
C
C Sammet author 10/29/2007

Actually I checked that first. It is populated and it is even moved to the Session Variable. I also checked and the Session variable for group is also set.
I used the Response.Write all over the place to check the variables and the code in the LoginOnLoad Event does execute exactly as expected. I even placed a Write directly in front of the redirect and it showed that the code does execute all the way through the redirect statement. But then the next execution happens inside the Login.asp code when it displays the login screen.
I tried placing an additional redirect in the login.asp code at the very beginning and it worked for a while, but then I started getting errors in the browser about trying to rewrite a header that has already been sent to the browser. I took out the extra redirect and it went back to functioning only it went back to sending me to the login page.
I hope that answers the question. I am trying to make sure I cover everything I have already tried. And I have tried most of these things multiple times. I have also been doing some digging at other ASP forums and I am wondering if it has something to do with buffering. Just a thought at this point.

Sergey Kornilov admin 10/29/2007

You can post your application to Demo Account (last tab in ASPRunnerPro) and send me the URL where I can see this issue.

C
C Sammet author 10/29/2007

Uploaded and the URL has been sent via email.

C
C Sammet author 10/29/2007

Ok, here is a new twist.
In my research I came across the idea of using Server.Transfer inplace of the Redirect. This mean commenting out line 6 in DBCOMMONS which did a post to the Response. After changing to the Server.Transfer and commenting out the single line it seems to work with only a small error left that states "document.forms.0.username is NULL or not an object" followed by an indication that the browser expected to be in the Login.asp page.
Like I said, this seems to function, but it worries me that the Redirect worked for the other screens just fine and this one and it's counterpart required a change to a different command. I would rather have them all use the same command rather than have some screens one way and some the other. This will work for now, but I really need to figure out what is wrong and why the normal redirect doesn't seem to work.
Thanks.