cookie novice
change | Posted 7:07am 15. November 2007 Server Time |
gents am new to asp and am confused i have the following code
page1
<HTML>
<BODY>
<FORM ACTION="cookieread.asp" METHOD="POST">
What's your name stranger?
<INPUT TYPE="TEXT" NAME="name">
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</BODY>
</HTML>
page2
<% @ Language=VBScript %>
<%
Response.Cookies("Name")= Request.Form("name")
Response.Cookies("Name").Expires="Jan 1, 2010"
%>
<%
Name = Request.Cookies("Name")
%>
<HTML>
<BODY>
Hi there <%=name%>!
</BODY>
</HTML>
<% @ Language=VBScript %>
page3
<%
Name is Request.Cookies("name")
%>
<HTML>
<BODY>
hi there <%Name%>
</BODY>
</HTML>
problem is page 3 is not returning the expected value which should be the same as the one written on page 1 and then assigned as a cookie value on page 2...help
|
katy8439 | Posted 7:30am 15. November 2007 Server Time |
I don't the the "Expires" is in the correct format. It should be:
Response.Cookies("name").Expires=#Jan 1, 2010#
As the format's incorrect it may be wiping the cooking which is why you can't see it on Page 3
Hope that Helps
Katy
change | Posted 7:52am 15. November 2007 Server Time |
katy tried it but it dont work ...question is if a cookie is assigned a value in page 2 and then i want to use that value in page 134 is that possible
WizzKidd | Posted 5:37am 6. December 2007 Server Time |
I just think you have written the coding incorrectly in page 3. It should say:
<%
Dim Name
Name = Request.Cookies("name")
%>
<HTML>
<BODY>
hi there <%= Name %>
</BODY>
</HTML>
- WizzKidd
Reply to Post cookie novice
|
|
|