www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > ASP

    ASP Discussion and technical support for using and deploying Active Server Pages.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-01-2009, 01:06 AM
    ASPSQLVB ASPSQLVB is offline
    Registered User
     
    Join Date: Nov 2006
    Posts: 177
    Retreive Cookies...Not Working

    Gang,

    I am writing a cookie file to the client then retreiving it and storing the values in a couple of text boxes.

    The problem is, I cannot retreive the cookie values. I see the file is in the cookie folder but when I try displaying the values it just doesn't work. Nothing is displayed. I am wondering if there is some other code within the webpage that interferes with the retrieval of cookies.

    Below is setting the cookie
    Code:
    Dim Login_Holder,Password_Holder
         
           Login_Holder = Request.Form("Login2")
           Password_Holder = Trim(Request.Form("Password2"))
    
    If RememberMe1 = "on" Then
            
                Response.Cookies("Login2") = Login_Holder
                Response.Cookies("Password2") = Password_Holder
              
     Dim cookieExpiration1
           cookieExpiration1 = DateAdd("d",RS3("LengthofEvent"),RS3("StartDate"))
                
                Response.Cookies("Login2").Expires = cookieExpiration1
                Response.Cookies("Password2").Expires = cookieExpiration1
    
    End If
    Below is retreiving the cookie
    HTML Code:
    <tr>
           <td name="Login" align="middle">
            <font color="white" size="3">
             <b>Username</b>
            </font>
             <input name="Login2" size="15" value="<%=Request.Cookies("Login2")%>">
           </td>
          </tr>
         
          <tr>
           <td align="middle">
           <font color="white" size="3"><b>Password</b></font>
            <input type="Password" name="Password2" size="15" value="<%=Request.Cookies("Password2")%>">       
            </td>
         </tr> 
          
         <tr>
          <td align="center">
            <input type="checkbox" name="RememberMe1" size="10"><font color="white" size="2">Remember Me</font>
            </td>
          </tr> 
          <tr>
    Reply With Quote
      #2  
    Old 11-04-2009, 11:29 PM
    ASPSQLVB ASPSQLVB is offline
    Registered User
     
    Join Date: Nov 2006
    Posts: 177
    Here's something strange......I can only Write the requested cookie values immedietly after setting the cookie values. When I try displaying the cookie values in another page, its all blank.

    The code below works in one .asp page and not the other. Makes absolutely no sense at all.
    Code:
              Response.Write Request.Cookies("Login2") & " " & Request.Cookies("Password2")
              Response.End
    Reply With Quote
      #3  
    Old 11-07-2009, 09:23 PM
    ASPSQLVB ASPSQLVB is offline
    Registered User
     
    Join Date: Nov 2006
    Posts: 177
    Gang,

    I have two seprate domains/websites. One website displays the cookie values and the other will not. Both websites use the same login script. The only difference is one website displays the cookie values and the other does not.

    I have called my web hosting company to see if there are restrictions on their end. I am waiting to get an answer from them.

    At this point I have no idea what could be causing this. Has anyone ever experienced this before ?
    Reply With Quote
      #4  
    Old 11-09-2009, 05:38 PM
    verikal verikal is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 17
    Try setting up cookie path...

    Code:
    Response.cookies("Login2").Path = "/"
    __________________
    My web site...
    בניית אתרים
    אחסון אתרים
    English version will be added soon.
    Reply With Quote
      #5  
    Old 11-09-2009, 07:08 PM
    ASPSQLVB ASPSQLVB is offline
    Registered User
     
    Join Date: Nov 2006
    Posts: 177
    Quote:
    Originally Posted by verikal View Post
    Try setting up cookie path...

    Code:
    Response.cookies("Login2").Path = "/"
    Hello and Thank You for replying.

    So, basically wrting the cookie value to a folder on the server......then retrieving the cookie value and display the values in the text boxes like this:

    Code:
     Response.Cookies("Login2") = Request.Form("Login2")
                Response.Cookies("Login2").Path = "/Cookies/Info"
                Response.Cookies("Password2") = Request.Form("Password2")
                Response.Cookies("Password2").Path = "/Cookies/Info"
    After trying the above code, I have noticed no cookies set on the server. I am guess ing this is incorrect ?
    Reply With Quote
      #6  
    Old 11-09-2009, 09:31 PM
    verikal verikal is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 17
    When you display server variables do you see the cookie ?

    Code:
    <table border="1">
    <tr>
       <td>Server Variable</td>
       <td>Value</td>
    </tr>
    <% 
    dim x
    For Each x In Request.ServerVariables
    %>
    <tr>
       <td><%=x%></td>
       <td><%=Request.ServerVariables(x)%></td>
    </tr>
    <%
    Next
    %>
    </table>
    Also try using the main path "/"
    __________________
    My web site...
    בניית אתרים
    אחסון אתרים
    English version will be added soon.

    Last edited by verikal; 11-09-2009 at 09:35 PM.
    Reply With Quote
      #7  
    Old 11-09-2009, 10:00 PM
    ASPSQLVB ASPSQLVB is offline
    Registered User
     
    Join Date: Nov 2006
    Posts: 177
    I do not see the variable.

    The Main path?....like, www.TestSite.com/Folder1/Cookies/test
    Reply With Quote
      #8  
    Old 11-10-2009, 05:27 AM
    verikal verikal is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 17
    No, the main path is just - "/"

    Do you see any cookie on the server variables ?
    __________________
    My web site...
    בניית אתרים
    אחסון אתרים
    English version will be added soon.
    Reply With Quote
      #9  
    Old 11-10-2009, 11:52 AM
    ASPSQLVB ASPSQLVB is offline
    Registered User
     
    Join Date: Nov 2006
    Posts: 177
    The problem is fixed !!! The cookie values are displayed in the Text Boxes for the Login in.

    What a relief ! The code below fixed the problem.

    Response.Cookies("Login2") = Request.Form("Login2")
    Response.Cookies("Login2").Path = "/"
    Response.Cookies("Password2") = Request.Form("Password2")
    Response.Cookies("Password2").Path = "/"

    THANK YOU VERIKAL. YOU JUST MADE MY LIFE A LITTLE BIT EASIER !

    Now we can move forward.

    Much appreciated !

    Ken
    Reply With Quote
      #10  
    Old 11-10-2009, 12:33 PM
    verikal verikal is offline
    Registered User
     
    Join Date: Nov 2009
    Posts: 17
    resolved

    I'm glad it worked out for you.
    __________________
    My web site...
    בניית אתרים
    אחסון אתרים
    English version will be added soon.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes 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 Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:13 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.