Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with login in a new window

Status
Not open for further replies.

am7555

Technical User
Mar 6, 2007
27
CA
Hi Guys,
I have 3 pages.
openwindow1.asp
openwindow2.asp
openwindow3.asp

In openwindow1.asp I have a login form that onSubmit opens openwindow2.asp(which is s new window) where a script confirms if the login info is correct then allows the user to see the content of openwindow2.asp, if the info is not valid then the script sends the user to openwindow3.asp.

The problem:

I want the login form on openwindow1.asp to open openwindow2.asp in a new window and execute the script accordingly. However, everytime that I try opening openwindow2.asp in a new window the scripts keeps sending me to openwindow3.asp rather that openwindow2.asp as if the login were incorrect.

How can I still open a new window and ge the validating script work as well.

The script I added is the script on openwindow2.asp that validates the login info sent from openwindow1.asp

Code:
<%
If Request.Form("username") = "member" AND Request.Form("password") = "member" Then
%>Content yada yada yada

Code:
<% Else %>
<%
Response.Redirect("openwindow3.asp")
End If
%>
Any help would be greatly appreciated,

Javier
 
Try a bit of simple debugging for a start. Replace this
Code:
Response.Redirect("openwindow3.asp")
with this
Code:
Response.Write ("username = *" & Request.Form('username')  & "* : password = *" & Request.Form('password') & "*" )
and see if you're getting what you expect

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Thanks johnwm,
I did the debugging and it I got:
the right page but because the redirect was not used and this:
username = ** : password = **

I do not know what is the problem and it's really bugging me.

Perhaps showing the way a open my window is the problem?
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>

link that opens window:

<a href="#" onclick="MM_openBrWindow('openwindow2.asp','','scrollbars=yes,resizable=yes,width=1024,height=768');return false">
<input type="submit" name="Submit" value="Submit" /></a>

 
Did you understand the line I gave you?:
Response.Write ("username = *" & Request.Form('username') & "* : password = *" & Request.Form('password') & "*" )
That will produce:
username = ** : password = **
only if the Request.Form variables are both empty. The problem lies with the setting of these variables. I suggest you look at as the code that you show for openwindow1.asp doesn't show how you think you're setting those variables.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Thanks again. I guess I didn't understand it. I'll take a look at link you provided. And get back to work. Cheers.
 
What I usually do in situations where I'm going to be opening multiple windows, is have my user log in on the first one, then set a session variable with the user ID. Then I can pick up that session variable from other windows spawned and know who it is.

I believe that when you open another window, the user information is lost; but using a session variable remembers who it was until a) the session times out or b) the windows are closed.



Just my 2¢
-Cole's Law: Shredded cabbage

--Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top