|
|||||||
| ASP Discussion and technical support for using and deploying Active Server Pages. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
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> |
|
#2
|
|||
|
|||
|
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
|
|
#3
|
|||
|
|||
|
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 ? |
|
#4
|
|||
|
|||
|
Try setting up cookie path...
Code:
Response.cookies("Login2").Path = "/"
|
|
#5
|
|||
|
|||
|
Quote:
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"
|
|
#6
|
|||
|
|||
|
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> Last edited by verikal; 11-09-2009 at 09:35 PM. |
|
#7
|
|||
|
|||
|
#8
|
|||
|
|||
|
No, the main path is just - "/"
Do you see any cookie on the server variables ? |
|
#9
|
|||
|
|||
|
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 |
|
#10
|
|||
|
|||
|
I'm glad it worked out for you.
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|