Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-07-2003, 06:59 PM   PM User | #1
chris_angell
Regular Coder

 
Join Date: Jul 2002
Location: Brighton, UK
Posts: 282
Thanks: 1
Thanked 0 Times in 0 Posts
chris_angell is an unknown quantity at this point
my page works using responce.write but does not when I use response.redirect ??? how

hello I have a page I want to redirect if the user has a password etc.. When i run the code it works fine if I put response.write in replace of response.redirect.. but why does it not work when I put response.redirect, I am daffled...

have i used if statments in the wrong place ?? hmm

here is my code,,

<% @LANGUAGE = VBScript %>
<!-- #INCLUDE FILE="dbconnection.asp" -->

<%
Dim Username
Username=request.form("Username")

strSQL = "SELECT * FROM tblClients WHERE tblClients.Username = '" & Username & "'"
rst1.open strSQL, strConnect, ado_Openkeyset, ado_LockOptimistic

if not(rst1.eof) then
rst1("Hits") = rst1("Hits") + 1
rst1.update
rst1.requery
else

end if

strSQL = "SELECT * FROM tblClients WHERE tblClients.UserName = '" & Username & "' AND tblClients.Password = '" & Password & "' AND tblClients.CompanyName = '" & Companyname & "'"

if not rst1.eof then%>
<%if rst1("SalesOrTech")=false then
id=rst1("RefID")
rst1.close
set rst1=nothing
Response.write "sales/sales.asp?u=" & username & "&p=" & password & "&id=" & id
else
id=rst1("RefID")
rst1.close
set rst1=nothing
Response.write "technical/tech.asp?u=" & username & "&p=" & password & "&id=" & id

end if
else
Response.write "pages/no_login_f.htm"
end if
%>

they need to be

Response.Redirect

oh and because I was new to the asp world.. I tried to get my code to do two functions... add a hit to a field and redirect the page to an according page ????
__________________
<marquee>thanks</marquee>
chris_angell is offline   Reply With Quote
Old 04-07-2003, 08:02 PM   PM User | #2
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
maybe it's because the path is incorrect? Check the path in your browser.

Also, i always compose that value before the redirect, like this.
Code:
dim file
file="sales/sales.asp?u=" + username + "&p=" + password + "&id=" + id
response.redirect (file)
raf is offline   Reply With Quote
Old 04-07-2003, 08:15 PM   PM User | #3
chris_angell
Regular Coder

 
Join Date: Jul 2002
Location: Brighton, UK
Posts: 282
Thanks: 1
Thanked 0 Times in 0 Posts
chris_angell is an unknown quantity at this point
thanks.. but it didn't work..

strange... ???????
__________________
<marquee>thanks</marquee>
chris_angell is offline   Reply With Quote
Old 04-07-2003, 09:04 PM   PM User | #4
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
Come again?

Just tryed it and it does for me.

Our you sure that the "sales" and "technical" and "pages" are subfolders of the folder where this asp-page is located in?

Did you look at the url the browser tryed to open?
raf is offline   Reply With Quote
Old 04-08-2003, 10:45 AM   PM User | #5
chris_angell
Regular Coder

 
Join Date: Jul 2002
Location: Brighton, UK
Posts: 282
Thanks: 1
Thanked 0 Times in 0 Posts
chris_angell is an unknown quantity at this point
um... I may be being stupid ?? thinking about it the reason it may not be working is because I don't have the sales and tech pages set up ? um but when I run this page.. it stays on this page.. the page I am trying to get the code working for...


I would have thought that it would have put the url in the browser of the page I am trying to find ??


any more help anyone


here is my page


http://www.connectonlinepreview.co.u...in/login_f.htm

for username and password and company put chris..... but see how it stays on the login page ??
__________________
<marquee>thanks</marquee>
chris_angell is offline   Reply With Quote
Old 04-08-2003, 12:00 PM   PM User | #6
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
Looked at the code of your loginpage (the html page, not the asp)

This piece a code is wrong and is probably the cause. You probably wanted them to be reset and submit buttons, but there not.

So when you click them, nothing happens. The form isn't posted
Code:
Wrong code!!

<input border="0" src="images/submit.gif" name="Submit" type="image" width="79" height="26">
                          </a></td>
                        <td width="50%"><a href="#" onMouseOut="MM_swapImgRestore()"  onMouseOver="MM_swapImage('Reset','','images/reset_f2.gif',1)"> 
                          <input border="0" src="images/reset.gif" name="Reset" type="image" width="79" height="26">
                          </a></td>
the buttons should be something like

<input type="submit" value="Login" name="submitform">

Try this first without the javascript and see if the form gets posted.
The values will then be posted to ansa/login.asp
raf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:47 AM.


Advertisement
Log in to turn off these ads.