Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Cookies

Status
Not open for further replies.

JackD4ME

Programmer
Jun 4, 2002
228
US
HI Everyone,
I am trying to create a cookie with vbscript. No matter what syntax I
use it errors out on the line with the response object. I am new to asp
and vbscript and the books aren't working.

Sub Login_onclick
window.alert (uspw.user.value)
Response.Cookies("OilLogin")("User")=(uspw.User.value) 'uspw is the name of the form
window.alert (request.cookies("OilLogin")("User"))
End Sub

The first msgbox appears with the correct input data but then nothing! I
know this is simple and should work but does not. Can someone please help?
 
Is this subroutine located before the <html> tag? When you set cookies they need to be set before the HTML tag (before content is sent to the browser).

There is a way aroud it though. If you need to set a cookie within the HTML tag (which I am assuming you are doing here), you need to incldue the following right after your <%@ Languge="VBScript" %> tag at the very top of your document:

<% response.buffer = true %>

When you set the buffer, the page will be retained in memeory until the entire page is processed. I hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top