By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,289 Members | 3,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,289 IT Pros & Developers. It's quick & easy.

Writing cookies

P: n/a
Hi all,

Anyone see anything wrong with the following:
************************************************** *************
<%@ LANGUAGE="VBSCRIPT" %>
<%
Option Explicit

Dim nAcctNbr
Dim nMsgStart
Dim nMsgEnd

If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
End If
If Not(Request.Cookies("MsgStart")="") Then
nMsgStart = CInt(Request.Cookies("MsgStart"))
End If
If Not(Request.Cookies("MsgEnd")="") Then
nMsgEnd = CInt(Request.Cookies("MsgEnd"))
End If

If Not (Session("USE_XML") = "True") Then
%>
<HTML>
<head>
<meta name="VI60_DTCScriptingPlatform" content="Server (ASP)">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<BODY>
<form method="post" action="page2.asp" name="Page1Frm">
From: <input type="text" width=100 name="FIRST" size="20"><BR>
Until: <input type="text" width=100 name="LAST" size="20"><BR>
Bundle id: <input type="text" width=100 name="BUNDLE_ID"
size="20"><BR>
<input type="submit" value="Submit" name="submit">
</form>
<%
Else 'if using XML
nAcctNbr = 0
nMsgStart = 0
nMsgEnd = 9
Response.Cookies("AcctNbr") = nAcctNbr
Response.Cookies("MsgStart")= nMsgStart
Response.Cookies("MsgEnd") = nMsgEnd
Response.Cookies("AcctNbr").Expires = DateAdd("d", 2, Now)
Response.Cookies("MsgStart").Expires= DateAdd("d", 2, Now)
Response.Cookies("MsgEnd").Expires = DateAdd("d", 2, Now)
%>
<HTML>
<head>
<meta name="VI60_DTCScriptingPlatform" content="Server (ASP)">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<BODY>
<FORM>
<XML ID="XMLID">
<%
Response.write "Finished."
%>
</XML>
<script language="JavaScript">
<!--
alert("Finished...");
-->
</script>
<BR>Complete<p><BR>
</FORM>
</BODY>
</HTML>
<%
End if 'USE_XML
%>
************************************************** *************

This has been tested on IE60 and Pocket IE. The cookies are NOT
writing to either browser.. :-(

Thanks for any insight in advance..

-BB
Jul 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Is the code actually running? I notice it's in a conditional block

________________________________________
Atrax. MVP, IIS
http://rtfm.atrax.co.uk/

newsflash : Atrax.Richedit 1.0 now released.
http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #2

P: n/a
Your refering to the USE_XML condition?

Yes this gets executed correctly .. I get the 'alert("Finished.")'
message in the <script> below the code for setting the cookies.
On Wed, 10 Sep 2003 01:02:25 -0700, Atrax <at***@dontspamatrax.co.uk>
wrote:
Is the code actually running? I notice it's in a conditional block

________________________________________
Atrax. MVP, IIS
http://rtfm.atrax.co.uk/

newsflash : Atrax.Richedit 1.0 now released.
http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 19 '05 #3

P: n/a
Hi Brian,

The code that sets the cookies is in an IF statement. Perhaps that section
of the IF statement is not being executed. Please move your Response.write
"Finished" statement to the ELSE section of the IF statement to verify that
the ELSE section is being executed.

Also, as an additional test, you have a segment of code as follows:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
End If

Change this to:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
Response.write Request.Cookies("AcctNbr")
End If

Thank you, Mike
Microsoft, ASP.NET

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-039? If not, Microsoft strongly advises you to
review the information at the following link regarding Microsoft Security
Bulletin MS03-039
http://www.microsoft.com/technet/sec...n/ms03-039.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the Windows Update scan will help to insure you are current
with all security patches, not just MS03-039.

Microsoft also highly recommends to all customers that you visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: Brian Burgess <bb********@hotmail.com>
Subject: Re: Writing cookies
Date: Wed, 10 Sep 2003 16:12:11 +0800
Message-ID: <l1********************************@4ax.com>
References: <8b********************************@4ax.com> <uY**************@TK2MSFTNGP12.phx.gbl> X-Newsreader: Forte Free Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: microsoft.public.inetserver.asp.general
NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252174
X-Tomcat-NG: microsoft.public.inetserver.asp.general

Your refering to the USE_XML condition?

Yes this gets executed correctly .. I get the 'alert("Finished.")'
message in the <script> below the code for setting the cookies.
On Wed, 10 Sep 2003 01:02:25 -0700, Atrax <at***@dontspamatrax.co.uk>
wrote:
Is the code actually running? I notice it's in a conditional block

________________________________________
Atrax. MVP, IIS
http://rtfm.atrax.co.uk/

newsflash : Atrax.Richedit 1.0 now released.
http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Jul 19 '05 #4

P: n/a
Well I have tried both these already for verification. Just is not
included in the code posted here for simplicity sake. Yes it is
verified that the proper section executes. Actually I can even step
through in a VID debugger...

On Wed, 10 Sep 2003 20:52:16 GMT, mi****@online.microsoft.com ("Mike
Moore [MSFT]") wrote:
Hi Brian,

The code that sets the cookies is in an IF statement. Perhaps that section
of the IF statement is not being executed. Please move your Response.write
"Finished" statement to the ELSE section of the IF statement to verify that
the ELSE section is being executed.

Also, as an additional test, you have a segment of code as follows:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
End If

Change this to:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
Response.write Request.Cookies("AcctNbr")
End If

Thank you, Mike
Microsoft, ASP.NET

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-039? If not, Microsoft strongly advises you to
review the information at the following link regarding Microsoft Security
Bulletin MS03-039
http://www.microsoft.com/technet/sec...n/ms03-039.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the Windows Update scan will help to insure you are current
with all security patches, not just MS03-039.

Microsoft also highly recommends to all customers that you visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: Brian Burgess <bb********@hotmail.com>
Subject: Re: Writing cookies
Date: Wed, 10 Sep 2003 16:12:11 +0800
Message-ID: <l1********************************@4ax.com>
References: <8b********************************@4ax.com>

<uY**************@TK2MSFTNGP12.phx.gbl>
X-Newsreader: Forte Free Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: microsoft.public.inetserver.asp.general
NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252174
X-Tomcat-NG: microsoft.public.inetserver.asp.general

Your refering to the USE_XML condition?

Yes this gets executed correctly .. I get the 'alert("Finished.")'
message in the <script> below the code for setting the cookies.
On Wed, 10 Sep 2003 01:02:25 -0700, Atrax <at***@dontspamatrax.co.uk>
wrote:
>Is the code actually running? I notice it's in a conditional block
>
>________________________________________
>Atrax. MVP, IIS
>http://rtfm.atrax.co.uk/
>
>newsflash : Atrax.Richedit 1.0 now released.
>http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/
>
>*** Sent via Developersdex http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!



Jul 19 '05 #5

P: n/a
Does there have to be a form to submit after setting a cookie??

On Wed, 10 Sep 2003 20:52:16 GMT, mi****@online.microsoft.com ("Mike
Moore [MSFT]") wrote:
Hi Brian,

The code that sets the cookies is in an IF statement. Perhaps that section
of the IF statement is not being executed. Please move your Response.write
"Finished" statement to the ELSE section of the IF statement to verify that
the ELSE section is being executed.

Also, as an additional test, you have a segment of code as follows:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
End If

Change this to:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
Response.write Request.Cookies("AcctNbr")
End If

Thank you, Mike
Microsoft, ASP.NET

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-039? If not, Microsoft strongly advises you to
review the information at the following link regarding Microsoft Security
Bulletin MS03-039
http://www.microsoft.com/technet/sec...n/ms03-039.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the Windows Update scan will help to insure you are current
with all security patches, not just MS03-039.

Microsoft also highly recommends to all customers that you visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: Brian Burgess <bb********@hotmail.com>
Subject: Re: Writing cookies
Date: Wed, 10 Sep 2003 16:12:11 +0800
Message-ID: <l1********************************@4ax.com>
References: <8b********************************@4ax.com>

<uY**************@TK2MSFTNGP12.phx.gbl>
X-Newsreader: Forte Free Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: microsoft.public.inetserver.asp.general
NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252174
X-Tomcat-NG: microsoft.public.inetserver.asp.general

Your refering to the USE_XML condition?

Yes this gets executed correctly .. I get the 'alert("Finished.")'
message in the <script> below the code for setting the cookies.
On Wed, 10 Sep 2003 01:02:25 -0700, Atrax <at***@dontspamatrax.co.uk>
wrote:
>Is the code actually running? I notice it's in a conditional block
>
>________________________________________
>Atrax. MVP, IIS
>http://rtfm.atrax.co.uk/
>
>newsflash : Atrax.Richedit 1.0 now released.
>http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/
>
>*** Sent via Developersdex http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!



Jul 19 '05 #6

P: n/a
This ASP is in a file that gets Server.Execute'd in a loop. If the
Server.Execute in the calling ASP is within an HTML tag, will that
have an effect?

On Wed, 10 Sep 2003 20:52:16 GMT, mi****@online.microsoft.com ("Mike
Moore [MSFT]") wrote:
Hi Brian,

The code that sets the cookies is in an IF statement. Perhaps that section
of the IF statement is not being executed. Please move your Response.write
"Finished" statement to the ELSE section of the IF statement to verify that
the ELSE section is being executed.

Also, as an additional test, you have a segment of code as follows:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
End If

Change this to:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
Response.write Request.Cookies("AcctNbr")
End If

Thank you, Mike
Microsoft, ASP.NET

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-039? If not, Microsoft strongly advises you to
review the information at the following link regarding Microsoft Security
Bulletin MS03-039
http://www.microsoft.com/technet/sec...n/ms03-039.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the Windows Update scan will help to insure you are current
with all security patches, not just MS03-039.

Microsoft also highly recommends to all customers that you visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: Brian Burgess <bb********@hotmail.com>
Subject: Re: Writing cookies
Date: Wed, 10 Sep 2003 16:12:11 +0800
Message-ID: <l1********************************@4ax.com>
References: <8b********************************@4ax.com>

<uY**************@TK2MSFTNGP12.phx.gbl>
X-Newsreader: Forte Free Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: microsoft.public.inetserver.asp.general
NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252174
X-Tomcat-NG: microsoft.public.inetserver.asp.general

Your refering to the USE_XML condition?

Yes this gets executed correctly .. I get the 'alert("Finished.")'
message in the <script> below the code for setting the cookies.
On Wed, 10 Sep 2003 01:02:25 -0700, Atrax <at***@dontspamatrax.co.uk>
wrote:
>Is the code actually running? I notice it's in a conditional block
>
>________________________________________
>Atrax. MVP, IIS
>http://rtfm.atrax.co.uk/
>
>newsflash : Atrax.Richedit 1.0 now released.
>http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/
>
>*** Sent via Developersdex http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!



Jul 19 '05 #7

P: n/a
Hi Brian,

Sorry for the delay. It does not matter if the server-side code is inside
an HTML tag. The server-side code can be anywhere in the page.

I'd like to return to basics for this. Please start a new blank page and
add this code. Then browse it and then refresh the page with IE and Pocket
IE. Then post the results.
<%
Response.Write Request.Cookies("abc")
Response.Cookies("abc") = "123"
Response.CacheControl="no-cache"
%>

Thank you, Mike
Microsoft, ASP.NET

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: Brian Burgess <bb********@hotmail.com>
Subject: Re: Writing cookies
Date: Thu, 11 Sep 2003 08:19:46 +0800
Message-ID: <sn********************************@4ax.com>
References: <8b********************************@4ax.com> <uY**************@TK2MSFTNGP12.phx.gbl>
<l1********************************@4ax.com>
<Ra**************@cpmsftngxa06.phx.gbl> X-Newsreader: Forte Free Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Newsgroups: microsoft.public.inetserver.asp.general
NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252313
X-Tomcat-NG: microsoft.public.inetserver.asp.general

This ASP is in a file that gets Server.Execute'd in a loop. If the
Server.Execute in the calling ASP is within an HTML tag, will that
have an effect?

On Wed, 10 Sep 2003 20:52:16 GMT, mi****@online.microsoft.com ("Mike
Moore [MSFT]") wrote:
Hi Brian,

The code that sets the cookies is in an IF statement. Perhaps that sectionof the IF statement is not being executed. Please move your Response.write"Finished" statement to the ELSE section of the IF statement to verify thatthe ELSE section is being executed.

Also, as an additional test, you have a segment of code as follows:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
End If

Change this to:
If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
Response.write Request.Cookies("AcctNbr")
End If

Thank you, Mike
Microsoft, ASP.NET

Microsoft Security Announcement: Have you installed the patch for MicrosoftSecurity Bulletin MS03-039? If not, Microsoft strongly advises you to
review the information at the following link regarding Microsoft SecurityBulletin MS03-039
http://www.microsoft.com/technet/sec...n/ms03-039.asp and/or tovisit Windows Update at http://windowsupdate.microsoft.com to install thepatch. Running the Windows Update scan will help to insure you are currentwith all security patches, not just MS03-039.

Microsoft also highly recommends to all customers that you visit the
http://www.microsoft.com/protect site and perform the three straightforwardsteps listed to improve your computerís security.

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
From: Brian Burgess <bb********@hotmail.com>
Subject: Re: Writing cookies
Date: Wed, 10 Sep 2003 16:12:11 +0800
Message-ID: <l1********************************@4ax.com>
References: <8b********************************@4ax.com>

<uY**************@TK2MSFTNGP12.phx.gbl>
X-Newsreader: Forte Free Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: microsoft.public.inetserver.asp.general
NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252174 X-Tomcat-NG: microsoft.public.inetserver.asp.general

Your refering to the USE_XML condition?

Yes this gets executed correctly .. I get the 'alert("Finished.")'
message in the <script> below the code for setting the cookies.
On Wed, 10 Sep 2003 01:02:25 -0700, Atrax <at***@dontspamatrax.co.uk>
wrote:

>Is the code actually running? I notice it's in a conditional block
>
>________________________________________
>Atrax. MVP, IIS
>http://rtfm.atrax.co.uk/
>
>newsflash : Atrax.Richedit 1.0 now released.
>http://rtfm.atrax.co.uk/infinitemonk...trax.RichEdit/
>
>*** Sent via Developersdex http://www.developersdex.com ***
>Don't just participate in USENET...get rewarded for it!



Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.