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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Redirect

Status
Not open for further replies.

tical

Programmer
Oct 26, 2001
5
GB
Hi,

I am trying to retrieve the id sent to the following script but for some reason it will not work, the correct names have been used etc. Anyone got any ideas !??

Note: the file checks a username and password against a text file, if OK redirects to page otherwise redirects to invalid password page.

<%Response.Buffer = True %>
<% Dim idnum
idnum = Request.querystring (&quot;numb&quot;)
' Connects and opens the text file
' DATA FORMAT IN TEXT FILE= &quot;username<SPACE>password&quot;

Set MyFileObject=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set MyTextFile=MyFileObject.OpenTextFile(Server.MapPath(&quot;\pass&quot;) & &quot;\passwords.txt&quot;)

' Scan the text file to determine if the user is legal
WHILE NOT MyTextFile.AtEndOfStream
' If username and password found
IF MyTextFile.ReadLine = Request.form(&quot;username&quot;) & &quot; &quot; & Request.form(&quot;password&quot;) THEN
' Close the text file
MyTextFile.Close
' Go to login success page
Session(&quot;GoBack&quot;)=Request.ServerVariables(&quot;SCRIPT_NAME&quot;)
'Response.Redirect (loc)
Response.Redirect &quot;../orange_project_edit.asp?num=&quot; & idnum
Response.end
END IF
WEND

' Close the text file
MyTextFile.Close
' Go to error page if login unsuccessful
Session(&quot;GoBack&quot;)=Request.ServerVariables(&quot;SCRIPT_NAME&quot;)
Response.Redirect &quot;invalid_orng_editProj.asp?num&quot; & idnum
Response.end

%>

Thanks


 
I've always had trobles using rdirect with a concatenated string, try to put the destination url in a separate variable eg:

Code:
DestinationOK = &quot;../orange_project_edit.asp?num=&quot; & idnum
Response.Redirect DestinationOK
 
idnum = Request.querystring (&quot;numb&quot;)

Response.Redirect &quot;invalid_orng_editProj.asp?num&quot; & idnum

should your querystring be the same as what you use in the Response.Redirect on error? if so, look closely, in the Request.QueryString, you use &quot;numb&quot;, but in the Response.Redirect, you use &quot;num&quot;
 
Did you try to do a response.write for the password and login name just to see that you have values?

Also, do a response.write to see if you have a value in idnum = Request.querystring (&quot;numb&quot;)
 
Thanks for the replies, but the value doesn't even seem to be sent somehow to this asp file !! It is very confusing, it should be v simple to do but for some reason I can't send the id number to it !!??
 
DONE, I couldn't use request.querystring needed to use request.form instead as I was using a POST method

Thanks anyway all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top