Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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>

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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)

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    thanks.. but it didn't work..

    strange... ???????
    <marquee>thanks</marquee>

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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>

  • #6
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •