Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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?


Reply With Quote
  #2 (permalink)  
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

Reply With Quote
  #3 (permalink)  
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

Reply With Quote
  #4 (permalink)  
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
Reply With Quote
  #5 (permalink)  
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

Reply With Quote
  #6 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:43 AM.


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