If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How to create Cookies?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-30-04, 10:32
graceson graceson is offline
Registered User
 
Join Date: Mar 2004
Location: India
Posts: 56
Smile How to create Cookies?

Dear Friends,

I am alive with Request.QueryString error.Here is new problem.

I want to store login details in client browser,and I want activate the text"Logout" in the place of "Login".All my .asp pages having top level banner as "Login".If one client is Loged in, how i can store login detail in client side and then how we can change "Login" to" Logout" ,and it should be only to that particular client. I am storing that login details in database.


Please help me in solving the problem.Need your valid suggestions


thanX

gmc
Reply With Quote
  #2 (permalink)  
Old 07-30-04, 13:02
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Response.Cookies and Request.Cookies

To create/update a cookie on the client's browser, all writing to the cookies must be done before anything is written to the browser. Once you've written the first "<" of the "<HTML>" tag, you're prohibited from writing to cookies.

On the other hand, you can read from cookies at any time since their values are stored in the server's memory from the initial request of the browser.

When your user logs in, you'd use Response.Cookies to write the value to the browser (Avoid storing personal information. Instead, store a unique identifier you can use to query the DB for more information.)

Response.Cookies("Login")("UserID") = "Bob"

You could simply do:

Response.Cookies("UserID") = "Bob"

But I like to group my cookie values together.

With that complete, your banner would simply use the Request.Cookies("Login")("UserID") to check to see if they have been authenticated:

If Trim(Request.Cookies("Login")("UserID")) <> "" Then...

Search the web for more information on the methods and properties of the Cookies collection.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 07-31-04, 02:35
graceson graceson is offline
Registered User
 
Join Date: Mar 2004
Location: India
Posts: 56
Thanx for yourn greate Information , I will try it
Reply With Quote
  #4 (permalink)  
Old 08-04-04, 02:16
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
And here are a few general cookie resources:

Cookie Monster: Using Cookies in ASP by Ian Stallings - 5/10/1999
http://www.4guysfromrolla.com/webtech/051099-1.shtml

Cookie
http://www.asp101.com/samples/cookie.asp

How do I detect ENABLED cookies / javascript?
http://www.aspfaq.com/show.asp?id=2058
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On