Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 28th, 2006, 01:54 AM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default Cookies

Hello all
I'm trying to write cookie for my login page.that knows the user and show welcome in the next pages.i did it befor but it doesn't work now.
in my login page i put this code:

response.cookies("UserInformation")("name")=reques t("txtUser")
in which txtUser is my UserName field in login page.
and in other pages I used response.write that cookie
would you please tell me where is the problem?


 
Old May 28th, 2006, 08:27 AM
Authorized User
 
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

Have you tried hard coding it to make sure your form request is setting the cookie properly?

response.cookies("UserInformation")("name")="A User"

response.write request.cookies("UserInformation")("name")

Earl
www.jhdesigninc.com

 
Old May 28th, 2006, 08:38 AM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

i tried response.cookies("UserInformation")("name")="my name"
and it works.but when i use the form fields it doesn't work?do you know where is the problem?
thank you

 
Old May 28th, 2006, 09:17 AM
Authorized User
 
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

Do
response.write request.form("txtUser") &"<-- txtUser"
response.end

What value is returned? I think the info from the form is not being returned to the cookie so the cookie is always blank. Its setting the cookie properly just the cookie always has a value of nothing.

If this is the case you want to confirm that txtUser is in fact the name of the textbox you are using.

Earl
www.jhdesigninc.com
 
Old May 29th, 2006, 01:00 AM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default

You're right.the cookie doesn't get the value of txtUser.i changed my code to this kind but it didn't work:
<script for="txtUser" language="vbScript" event="onkeypress">
response.cookies("UserInformation")("Name")=docume nt.form1.txtUser.Value
</script>
in which form1 is my form name.
can we set the cookie value in this way????
I would be very happy if you help me.
thank you for your replies

 
Old May 29th, 2006, 07:36 AM
Authorized User
 
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

will this work? I suspect the code you currently have will not work browsers other than ie the code below will work with all browsers.

--Page1
<form action="page2.asp" method="post">
Name
<input name="txtUser" type="text">
<input type="submit" name="Submit" value="Submit">
</form>


--Page2
response.cookies("UserInformation")("name")=reques t("txtUser")

Earl
www.jhdesigninc.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
Should I use cookies?? Help Tee88 Classic ASP Basics 3 January 21st, 2005 12:33 AM
Cookies shabboleth Beginning PHP 3 December 30th, 2003 10:32 AM
Cookies cjo ASP.NET 1.0 and 1.1 Basics 1 November 8th, 2003 02:38 PM
Help!About Cookies jelsen ASP.NET 1.0 and 1.1 Basics 2 September 9th, 2003 08:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.