473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ASP sessionstate

I eliminated cookies from my shopping cart this morning. I'm now using
sessions to keep track of users.

In my global.asa I have the following:

sub Session_onStart
session.Timeout = 20
session("ticket") = CInt(0)
end sub
sub Session_onEnd
set session("ticket") = nothing
end sub

I have a conditional to see if ticket is 0 or null. In my addtocart.asp
file, if true, I assign a cart ID. If true, in my cart and other pages, if
true, I send the user to the web root because they should not be on these
pages if ticket is not greater than 0.

It works well on one site. On another, on a 2nd purchase, it appears to
lose its state, thus redirecting to the web root.

The difference between the 2 sites is one site has a mix of asp and aspx.
This is the one with issue. Is there something I must do with the
global.asax or could something else be involved?

There are no .aspx files in my store or shopping cart. It is completely
classic asp. I don't know if I've provided enough information since ASP
sessions are foreign to me.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #1
17 4978
Roland Hall wrote on 08 feb 2005 in
microsoft.public.inetserver.asp.general:
sub Session_onEnd
set session("ticket") = nothing
end sub


Why is that?

All session variables are lost at the end of the session anyway.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #2
"Evertjan." wrote in message news:Xn********************@194.109.133.29...
: Roland Hall wrote on 08 feb 2005 in
: microsoft.public.inetserver.asp.general:
:
: > sub Session_onEnd
: > set session("ticket") = nothing
: > end sub
: >
:
: Why is that?
:
: All session variables are lost at the end of the session anyway.

Thanks for your response.

I have no idea. I'm just following an example. Are you saying I never need
anything in my global.asa for Session_OnEnd to clear out a session variable?

I did notice I couldn't use this at the end of a sale (the receipt) so I
just set it back to 0 because a new sale should not have the same cart ID.

Could the set in OnEnd be the issue I'm having?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


Jul 22 '05 #3
Here are some of the reasons that sessions sometimes disappear

http://www.aspfaq.com/show.asp?id=2157

On IIS6 I believe there can also be some problems depending on how the site
"pools" processes for requests (processes cannot share session data).

--
--Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com

"Roland Hall" <nobody@nowhere> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
I eliminated cookies from my shopping cart this morning. I'm now using
sessions to keep track of users.

In my global.asa I have the following:

sub Session_onStart
session.Timeout = 20
session("ticket") = CInt(0)
end sub
sub Session_onEnd
set session("ticket") = nothing
end sub

I have a conditional to see if ticket is 0 or null. In my addtocart.asp
file, if true, I assign a cart ID. If true, in my cart and other pages,
if
true, I send the user to the web root because they should not be on these
pages if ticket is not greater than 0.

It works well on one site. On another, on a 2nd purchase, it appears to
lose its state, thus redirecting to the web root.

The difference between the 2 sites is one site has a mix of asp and aspx.
This is the one with issue. Is there something I must do with the
global.asax or could something else be involved?

There are no .aspx files in my store or shopping cart. It is completely
classic asp. I don't know if I've provided enough information since ASP
sessions are foreign to me.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Jul 22 '05 #4
"Mark Schupp" wrote in message news:Ok**************@TK2MSFTNGP12.phx.gbl...
: Here are some of the reasons that sessions sometimes disappear
:
: http://www.aspfaq.com/show.asp?id=2157
:
: On IIS6 I believe there can also be some problems depending on how the
site
: "pools" processes for requests (processes cannot share session data).

Thanks Mark. You reminded me of something I left out of my post. I'm using
IIS 5.0. I'll check out the link or Aaron's site.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Jul 22 '05 #5
Roland Hall wrote on 08 feb 2005 in
microsoft.public.inetserver.asp.general:
"Evertjan." wrote in message
news:Xn********************@194.109.133.29...
: Roland Hall wrote on 08 feb 2005 in
: microsoft.public.inetserver.asp.general:
:
: > sub Session_onEnd
: > set session("ticket") = nothing
: > end sub
: >
:
: Why is that?
:
: All session variables are lost at the end of the session anyway.

Thanks for your response.

I have no idea. I'm just following an example.
Don't. Programming is understanding what you are doing.
Are you saying I
never need anything in my global.asa for Session_OnEnd to clear out a
session variable?
Yes. consider why that would be necessary?

If the session variable would persist after the session is ended,
would it turn up on a session of a random other user????
I did notice I couldn't use this at the end of a sale (the receipt) so
I just set it back to 0 because a new sale should not have the same
cart ID.
It seems you don't understand the concept of a session.
Perhaps first read up on that, Roland?
Could the set in OnEnd be the issue I'm having?


I did not look into that.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #6
"Evertjan." wrote in message news:Xn********************@194.109.133.29...
: Roland Hall wrote on 08 feb 2005 in
: microsoft.public.inetserver.asp.general:
:
: > "Evertjan." wrote in message
: > news:Xn********************@194.109.133.29...
: >: Roland Hall wrote on 08 feb 2005 in
: >: microsoft.public.inetserver.asp.general:
: >:
: >: > sub Session_onEnd
: >: > set session("ticket") = nothing
: >: > end sub
: >: >
: >:
: >: Why is that?
: >:
: >: All session variables are lost at the end of the session anyway.
: >
: > Thanks for your response.
: >
: > I have no idea. I'm just following an example.
:
: Don't. Programming is understanding what you are doing.

I clear out objects in subs/funcs too even thought they're supposed to be
clearing them. I seem to remember a large discusson on this issue a while
back.

: > Are you saying I
: > never need anything in my global.asa for Session_OnEnd to clear out a
: > session variable?
:
: Yes. consider why that would be necessary?

If there were no bugs in IIS and IE, I'd probably think differently.

: If the session variable would persist after the session is ended,
: would it turn up on a session of a random other user????

I dunno. Why does it work with the first and every subsequent sale if I
close the browser after each sale? Why does it fail on the 2nd sale
occassionally?

: > I did notice I couldn't use this at the end of a sale (the receipt) so
: > I just set it back to 0 because a new sale should not have the same
: > cart ID.
:
: It seems you don't understand the concept of a session.
: Perhaps first read up on that, Roland?

I think I understand the concept of a session, which is different than a
session variable. IIS, by default, says my sessions are 20 minutes. I can
create a session variable and destroy it or initialize it whenever I want.
Granted I do not propose to be a Session Master but I'm probably past the
concept part. I tried to stay away from sessions because almost all of what
I have read is they're not completely reliable. However, I have found out
cookies have their own issues which is why I'm looking for an alternative.
If there is something better, meaning more reliable, I'm open.

: > Could the set in OnEnd be the issue I'm having?
:
: I did not look into that.

Well, thanks for the parts you did look into.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #7
"Roland Hall" wrote in message news:uu**************@TK2MSFTNGP14.phx.gbl...
: "Mark Schupp" wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
:: Here are some of the reasons that sessions sometimes disappear
::
:: http://www.aspfaq.com/show.asp?id=2157
::
:: On IIS6 I believe there can also be some problems depending on how the
: site
:: "pools" processes for requests (processes cannot share session data).
:
: Thanks Mark. You reminded me of something I left out of my post. I'm
using
: IIS 5.0. I'll check out the link or Aaron's site.

I don't seem to fall within the caveats of anything listed.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #8
Roland Hall wrote on 08 feb 2005 in
microsoft.public.inetserver.asp.general:
I clear out objects in subs/funcs too even thought they're supposed to
be clearing them. I seem to remember a large discusson on this issue
a while back.


But clearing variables is not very usefull, Roland.

The sesion_onend only fires at the end of the session,
after say 20 minutes in your said case.

The variables will be gont THEN anyway.

======================

I don't think this has anything to do with your problem, by the way.

Usually, in my experience, if something runs on one server and not on
another, there is a difference in server/IIS setup parameters, and that is
not my specialty.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #9
"Evertjan." wrote in message news:Xn******************@194.109.133.29...
: Roland Hall wrote on 08 feb 2005 in
: microsoft.public.inetserver.asp.general:
: > I clear out objects in subs/funcs too even thought they're supposed to
: > be clearing them. I seem to remember a large discusson on this issue
: > a while back.
:
: But clearing variables is not very usefull, Roland.

It clears memory and I remember reading about XML DOM requiring memory be
released to avoid major issues.

: The sesion_onend only fires at the end of the session,
: after say 20 minutes in your said case.

Yes, that is how it is supposed to work. MSFT wrote a patch for something
misfiring at 12-20 minutes running in the global.asa but it wasn't tied to
my issue.

: The variables will be gont THEN anyway.

But I need them gone before 20 minutes, or shall I say, I might need them
gone before the session times out but I don't want to have the destroyed
before that time. However, as I stated, I do not have to use sessions for
this issue, but they are my next choice for testing for a permanent
solution. I have new customers waiting for this phase of the project to
complete.

: ======================
:
: I don't think this has anything to do with your problem, by the way.
:
: Usually, in my experience, if something runs on one server and not on
: another, there is a difference in server/IIS setup parameters, and that is
: not my specialty.

Yes, there are most likely differences between the server setups but as far
as sessions, there aren't. I was looking for some insight on caveats with
sessions and perhaps some best practice tips, what to avoid, etc. After
reading the article at aspfaq.com, it appears to not cover all the
possibilities since none of those relate and I am having intermittent
results.

I read numerous articles today about the differences between empty, null and
nothing. I am checking for the variable to be either:

= "" or IsNull. Should I be using IsEmpty instead and will that make a
difference? I am unable to find anything definite on this.

The odd thing is I use the same test on multiple pages and only the receipt
pages lose the session state, except for online purchase since they post to
a page the user never sees to write an XML file and then redirect to
FirstPay to take their payment.

One would think if it was the code, it would do the same on each page or on
all sites. However, its always after the checkout page and only on one
site. I can shop for as long as I want without incident and never on the
first shopping experience after the browser is opened.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Jul 22 '05 #10
Some interesting news:

Firefox never fails. Only IE has the issue. We found out the value is
being set to 0 and we also found out that receipts, while not displaying on
screen, are being written to disk. This is the same issue I had with
cookies so it must be something I'm doing in the way I write the page.
Without throwing the whole page up, I'll cover the main parts.

ASP directive and turn on buffering
2 include files, 1 for nocache and 1 for my common routines
Dim vars
' My session test
if session("ticket") = 0 or IsEmpty(session("ticket")) then
Response.Clear
Response.Redirect("/")
else
cartid = session("ticket")
end if
get form values and assign them to variables
HTML code is written into strings using ASP - Ex. str = "<html>"... ASP
variables included where required.
As I need to write VBScript code, I do that, then add another string of HTML
code, etc.
There are 7 strings
After the third, I grab the shopping cart from an XML file and put the
results into an array.
I loop through the array adding the purchased items to the receipt, add more
HTML code and write the string to the screen.
After the strings are assigned and written to the screen, I write the
receipt, passing the cart ID and the strings to a sub.
At the end I have to subs, delete the cart file and set the session number
to 0.

I believe since I'm buffering the page, and the receipt is being written,
the cart file delete and session initialization are happening and then my
test at the top is being performed so I sometimes do not see the receipt.
Why Firefox doesn't have a problem with it or why it works sometimes, is
confusing. I removed the nocache include and now it only fails after 3
successful ones for me.

I've decided to take a different approach. After the receipt is written, I
call another page to cleanup and then redirect to the home page. This
effectively eliminates the issue and makes it stable. IE apparently
executes code on the page in some unknown order thus making the last line of
code excute before the some at the top.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Jul 22 '05 #11
Roland Hall wrote on 09 feb 2005 in
microsoft.public.inetserver.asp.general:
"Evertjan." wrote in message
news:Xn******************@194.109.133.29...
: Roland Hall wrote on 08 feb 2005 in
: microsoft.public.inetserver.asp.general:
: > I clear out objects in subs/funcs too even thought they're supposed
: > to be clearing them. I seem to remember a large discusson on this
: > issue a while back.
:
: But clearing variables is not very usefull, Roland.

It clears memory and I remember reading about XML DOM requiring memory
be released to avoid major issues.
DOM is a browser issue. Session variables live on the server.
: The sesion_onend only fires at the end of the session,
: after say 20 minutes in your said case.

Yes, that is how it is supposed to work. MSFT wrote a patch for
something misfiring at 12-20 minutes running in the global.asa but it
wasn't tied to my issue.

: The variables will be gont THEN anyway.

But I need them gone before 20 minutes,
With your session_onend code they are only destroyed at that period
[unless you define a different session period or do a session.end],
at which time they are destroyed by the system anyway.
or shall I say, I might need
them gone before the session times out but I don't want to have the
destroyed before that time.
I don't understand what you mean here.
There is no difference between "gone" ans "destroyed".
However, as I stated, I do not have to
use sessions for this issue, but they are my next choice for testing
for a permanent solution. I have new customers waiting for this phase
of the project to complete.

: ======================
:
: I don't think this has anything to do with your problem, by the way.
:
: Usually, in my experience, if something runs on one server and not on
: another, there is a difference in server/IIS setup parameters, and
: that is not my specialty.

Yes, there are most likely differences between the server setups but
as far as sessions, there aren't. I was looking for some insight on
caveats with sessions and perhaps some best practice tips, what to
avoid, etc. After reading the article at aspfaq.com, it appears to
not cover all the possibilities since none of those relate and I am
having intermittent results.

I read numerous articles today about the differences between empty,
null and nothing. I am checking for the variable to be either:

= "" or IsNull. Should I be using IsEmpty instead and will that make
a difference? I am unable to find anything definite on this.
A not existing session variable or an empty one both return an empty
string.

if session("myNotExisting")="" then ...

and

session("myEmpty") = ""
if session("myEmpty")="" then ...

act the same.

So "empty, null and nothing" are not an issue with session variables.
The odd thing is I use the same test on multiple pages and only the
receipt pages lose the session state, except for online purchase since
they post to a page the user never sees to write an XML file and then
redirect to FirstPay to take their payment.
So the session variable is not the direct problem but you seem to loose
the session alltogether?

Could this be a domain change issue??

Do you heve different domains in your code, like https:// next to
http://, or even a single .html or .aspx step? All these could break the
session, I think.

Or perhaps a [=your] browser isssue, where some domains aare refused to
make the session cookie to establish a session-id?
One would think if it was the code, it would do the same on each page
or on all sites. However, its always after the checkout page and only
on one site. I can shop for as long as I want without incident and
never on the first shopping experience after the browser is opened.


Serious debugging seems to be necessary, like writing a dedicated log
file giving an entry whenever a new session is started and comparing that
with your time documented actions as a user.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #12
Roland Hall wrote on 09 feb 2005 in
microsoft.public.inetserver.asp.general:
Firefox never fails. Only IE has the issue.
so it is a clientside issue. ASP doesn't know or care what browser it
sends his rendered html output to.
We found out the value
is being set to 0 and we also found out that receipts, while not
displaying on screen, are being written to disk. This is the same
issue I had with cookies so it must be something I'm doing in the way
I write the page. Without throwing the whole page up, I'll cover the
main parts.

ASP directive and turn on buffering
2 include files, 1 for nocache and 1 for my common routines
Dim vars
' My session test
if session("ticket") = 0 or IsEmpty(session("ticket")) then
if session("ticket") = 0 or session("ticket")="" then

will cover all possibilities.

session("ticket") = 0 can ony be returned if it was initialiszed
somewhere else serverside.
Response.Clear
Response.Redirect("/")
Response.Clear is unnecessary before a redirect.
Any cached html-to-be-sent will be deatroyed anyway.

If html is already sent [by a response.flush?]
Response.Clear cannot stop that and
the Response.Redirect is invalid,
as Response.Redirect sends a header instruction
to the browser to redirect
and cannot do that if the header is already sent.
else
cartid = session("ticket")
end if
get form values and assign them to variables
HTML code is written into strings using ASP - Ex. str = "<html>"...
ASP variables included where required. As I need to write VBScript code
Serverside? [also serverside Jscript is possible if you prefer]
, I do that, then add another string
of HTML code, etc.
There are 7 strings
After the third, I grab the shopping cart from an XML file and put the
results into an array.
I loop through the array adding the purchased items to the receipt,
add more HTML code and write the string to the screen.
Not to the server screen, surely?
You send the string as rendered html to the browser with a
response.write?
After the strings are assigned and written to the screen, I write the
receipt, passing the cart ID and the strings to a sub.
Sorry, I cannot follow you here.
At the end I have to subs,
Sorry, I cannot follow you here.
delete the cart file and set the session
number to 0.
What is a session number? Never heard of that.
[If you mean session-id, do not touch that.]
I believe since I'm buffering the page, and the receipt is being
written, the cart file delete and session initialization are happening
and then my test at the top is being performed so I sometimes do not
see the receipt.
Session initialisation is done by the server system, before the
sesrverside execution of the first page of a session begins. The server
first examines the page request from the browser, and if there is no
[valid] session-id cookie value, the ASP server starts a new session.

You cannot do anything [like cart file delete] before session
initialisation.
Why Firefox doesn't have a problem with it or why it
works sometimes, is confusing. I removed the nocache include and now
it only fails after 3 successful ones for me.

I've decided to take a different approach. After the receipt is
written, I call another page to cleanup and then redirect to the home
page. This effectively eliminates the issue and makes it stable. IE
apparently executes code on the page in some unknown order thus making
the last line of code excute before the some at the top.


IE, firefox or any other browser do not execute ASP code at all!!!

Do you perhaps mean clientside code?
Do you have clientside vbscript?
[That will only be executed by IE and not by firefox.]

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #13
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
: Roland Hall wrote on 09 feb 2005 in
: microsoft.public.inetserver.asp.general:
: > Firefox never fails. Only IE has the issue.
:
: so it is a clientside issue. ASP doesn't know or care what browser it
: sends his rendered html output to.

Which is why it doesn't make any sense. Why does IE fail and Firefox work,
everytime?

: > We found out the value
: > is being set to 0 and we also found out that receipts, while not
: > displaying on screen, are being written to disk. This is the same
: > issue I had with cookies so it must be something I'm doing in the way
: > I write the page. Without throwing the whole page up, I'll cover the
: > main parts.
: >
: > ASP directive and turn on buffering
: > 2 include files, 1 for nocache and 1 for my common routines
: > Dim vars
: > ' My session test
: > if session("ticket") = 0 or IsEmpty(session("ticket")) then
:
: if session("ticket") = 0 or session("ticket")="" then
:
: will cover all possibilities.

So, session("ticket") = "" is equal to IsEmpty(session("ticket")) ?

: session("ticket") = 0 can ony be returned if it was initialiszed
: somewhere else serverside.

It is initialized as 0 in the beginning, then it is set based upon the
ticket number given when the first item is added to the cart.
The receipt pages, which this issue happens, the very last line of code
calls for a sub(routine) which resets the value to 0.

: > Response.Clear
: > Response.Redirect("/")
:
: Response.Clear is unnecessary before a redirect.
: Any cached html-to-be-sent will be deatroyed anyway.

Then there is a lot of misinformation because I have read Response.Clear
should be used if Response.Redirect is being called inline.

: If html is already sent [by a response.flush?]

I tried using Response.Flush but with a Response.Redirect it has an issue
and after it is too late, at least on this page.

: Response.Clear cannot stop that and
: the Response.Redirect is invalid,
: as Response.Redirect sends a header instruction
: to the browser to redirect
: and cannot do that if the header is already sent.
:
: > else
: > cartid = session("ticket")
: > end if
: > get form values and assign them to variables
: > HTML code is written into strings using ASP - Ex. str = "<html>"...
: > ASP variables included where required.
:
: > As I need to write VBScript code
:
: Serverside? [also serverside Jscript is possible if you prefer]

No, I do not prefer JScript server-side.

: > , I do that, then add another string
: > of HTML code, etc.
: > There are 7 strings
: > After the third, I grab the shopping cart from an XML file and put the
: > results into an array.
: > I loop through the array adding the purchased items to the receipt,
: > add more HTML code and write the string to the screen.
:
: Not to the server screen, surely?

How can a Response.Write write to the server screen?

I am referring to:
str = "blah blah blah"
Response.Write ("<div>" & str & "</div>" & vbCrLf)

in lieu of...

str = "blah blah blah"
%>
<div><%=str%></div>

: You send the string as rendered html to the browser with a
: response.write?

see above

: > After the strings are assigned and written to the screen, I write the
: > receipt, passing the cart ID and the strings to a sub.
:
: Sorry, I cannot follow you here.

The receipt is a file:

str, str2, str3, str4, str5, str6 are written to the screen.
str, str2, str3, str4, str5, str7 are written to the receipt file.

Make sense yet?

str = "........."
Response.Write str

more vbs code

str2 = "......." & vbs var & "......"
Response.Write str2

.... str7

writeReceipt cartid, str, str2, str3, str4, str5, str7

str6 has a button that is required for the shopper to click on but it not
needed in the receipt

:
: > At the end I have to subs,
:
: Sorry, I cannot follow you here.

Should have said 2 sub(routine)s

: > delete the cart file and set the session
: > number to 0.

delXMLFile cartid
delSession cartid

: What is a session number? Never heard of that.
: [If you mean session-id, do not touch that.]

cart session variable (cartid)

: > I believe since I'm buffering the page, and the receipt is being
: > written, the cart file delete and session initialization are happening
: > and then my test at the top is being performed so I sometimes do not
: > see the receipt.
:
: Session initialisation is done by the server system, before the
: sesrverside execution of the first page of a session begins. The server
: first examines the page request from the browser, and if there is no
: [valid] session-id cookie value, the ASP server starts a new session.

But that is not what is happening.

Here is a picture of the issue, forget everything else:

check cart id. If it is = 0 or empty, redirect the user to the home page.
....
more code follows
....
' last 2 lines of code
delete the cart file
reset cartid to 0

The last line of code is being processed before the check cart id above it
because that is setting it to zero. I know it's happening because when I
remove the last 2 lines and put them in another file, use the button click
in "str6" to point to that file, which then runs those routines and then
redirects to the home page, it works every time with every browser.
However, Firefox worked every time the old way. Yes, you, I and everyone
else on the planet understand the browser only works with what the
server-side gives it but then the browser shouldn't make a difference and it
does. The browser cannot change that value, so it has to be server-side and
the last line is the only place it is done on that page.

I can only conclude that with Response.Buffer = True, that MSFT is
processing the whole page before it gives it to the browser, but it appears
to be processing external routines before inline conditionals. I can't even
believe I'm saying that but it appears to be what is happening.

: You cannot do anything [like cart file delete] before session
: initialisation.

session variable re-initialization

: > Why Firefox doesn't have a problem with it or why it
: > works sometimes, is confusing. I removed the nocache include and now
: > it only fails after 3 successful ones for me.
: >
: > I've decided to take a different approach. After the receipt is
: > written, I call another page to cleanup and then redirect to the home
: > page. This effectively eliminates the issue and makes it stable.
:
: > IE
: > apparently executes code on the page in some unknown order thus making
: > the last line of code excute before the some at the top.
:
: IE, firefox or any other browser do not execute ASP code at all!!!

I know which is why none of this makes any sense. When things are not as
they should be, then they are as they shouldn't be.

: Do you perhaps mean clientside code?

Nope. Don't have any other than onclick events.

: Do you have clientside vbscript?

Nope. All client-side code I write is javascript.

: [That will only be executed by IE and not by firefox.]

I'm aware. Ok, as if this is not long enough, I'm going to show you the
code for the mailinorder in a new page.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #14

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
%>
<!--#include virtual="/cart/nocache.asp"-->
<!--#include virtual="/cart/header.asp"-->
<%

dim sFirstName, sLastName, sAddress1, sAddress2, sCity, sState
dim sPostalCode, sCountry, sPhone, sEmail, sReferral, sOther, discount,
promomsg
dim subtotal, salestax, shipping, freighttotal, grandtotal, action
dim cardname, authenticator, URL, postData, str, str2, str3, str4, str5,
str6, str7
dim getDate, getTime, order, items, o

if session("ticket") = 0 or IsEmpty(session("ticket")) then
Response.Clear
Response.Redirect("/")
else
cartid = session("ticket")
end if

sFirstName = Request.Form("iFirstName")
sLastName = Request.Form("iLastName")
sAddress1 = Request.Form("iAddress1")
sAddress2 = Request.Form("iAddress2")
sCity = Request.Form("iCity")
sState = Request.Form("iState")
sPostalCode = Request.Form("iPostalCode")
sCountry = Request.Form("iCountry")
sPhone = Request.Form("iPhone")
sEmail = Request.Form("iEmail")
sReferral = Request.Form("iReferral")
sOther = Request.Form("iOther")
subtotal = Request.Form("subtotal")
discount = Request.Form("discount")
promomsg = Request.Form("promomsg")
salestax = Request.Form("salestax")
shipping = Request.Form("shipping")
freighttotal = Request.Form("freight")
grandtotal = Request.Form("grandtotal")

str = "<html>" & vbCrLf & _
"<head><title>" & mName & "</title>" & vbCrLf & _
"<link rel=""stylesheet"" type=""text/css"" href=""" & cartPath &
"css/cart.css"" media=""screen"" />" & vbCrLf & _
"<link rel=""stylesheet"" type=""text/css"" href=""" & cartPath &
"css/printstyles.css"" media=""print"" />" & vbCrLf & _
"</head>" & vbCrLf & _
"<body>"
prt str

getDate = FormatDateTime(Date, 1)
getTime = FormatDateTime(now, 3)

str2 = "<div style=""font-weight: bold"">" & getDate & " " & getTime &
"</div>" & vbCrLf & _
"<div style=""font-weight: bold"">Reference Code: " & cartid & "</div>" &
vbCrLf & _
"<br />" & vbCrLf & _
"<fieldset class=""checkField""><legend>Customer Shipping
Information</legend>" & vbCrLf & _
"<div class=""boldCenter""><span>" & mName & " Mail-in Order Form" &
"</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Customer Name:</span> <span
class=""recDesc"">" & sFirstName & " " & sLastName & "</span></div>" &
vbCrLf & _
"<div><span class=""recLabel"">Address:</span> <span class=""recDesc"">" &
sAddress1 & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">:</span> <span class=""recDesc"">" &
sAddress2 & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">City:</span> <span class=""recDesc2"">" &
sCity & "</span> <span class=""recLabel2"">State: </span><span
class=""recDesc2"">" & sState & "</span> <span class=""recLabel2"">Zip:
</span><span class=""recDesc2"">" & sPostalCode & "</span></div>" & vbCrLf &
_
"<div><span class=""recLabel"">Country:</span> <span class=""recDesc"">" &
sCountry & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Email:</span> <span class=""recDesc"">" &
sEmail & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Phone:</span> <span class=""recDesc"">" &
sPhone & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Referred by:</span> <span
class=""recDesc"">" & sReferral & "</span></div>"
prt str2

str3 = ""
if sReferral = "Other" Then
str3 = str3 & "<div><span class=""recLabel"">:</span> <span
class=""recDesc"">" & sOther & "</span></div>" & vbCrLf
end if

str3 = str3 & "</fieldset>" & vbCrLf & _
"<fieldset class=""checkField""><legend>Product Information</legend>" &
vbCrLf & _
"<div><span class=""recColumn"">Name</span><span
class=""recColumn"">Quantity</span></div>"
prt str3

order = getXMLShoppingCart(cartid)

str4 = ""
for o = 0 to ubound(order)
items = Split(order(o),"---")
if o mod 2 = 0 Then
str4 = str4 & "<div style=""background-color: #efe""><span
class=""recItemsLeft"">" & items(2) & "</span><span
class=""recItemsRight"">" & items(5) & "</span></div>" & vbCrLf
else
str4 = str4 & "<div style=""background-color: #fff""><span
class=""recItemsLeft"">" & items(2) & "</span><span
class=""recItemsRight"">" & items(5) & "</span></div>" & vbCrLf
end if
next

str4 = str4 & "</fieldset>" & vbCrLf & _
"<fieldset class=""checkField""><legend>Order Totals</legend>" & vbCrLf & _
"<div><span class=""recLabel"">Subtotal:</span> <span class=""recTotals"">"
& subtotal & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Discount:</span> <span
class=""recTotalsR"">" & discount & "</span> <span class=""promo"">" &
promomsg & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Tax:</span> <span class=""recTotals"">" &
salestax & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Shipping:</span> <span class=""recTotals"">"
& shipping & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Freight:</span> <span class=""recTotals"">"
& freighttotal & "</span></div>" & vbCrLf & _
"<div><span class=""recLabel"">Total:</span> <span class=""recTotals"">" &
grandtotal & "</span></div>" & vbCrLf & _
"</fieldset>"
prt str4

str5 = "<fieldset class=""checkField""><legend>Terms and
Conditions</legend>" & vbCrLf & _
"<div class=""directions""><span>I have read and agree to the Terms and
Conditions located at http://" & servername & termsandconditions &
".</span></div>" & _
"<div class=""directions""><span>Print this page and keep it for your
records. Mail your check to:</span></div>" & vbCrLf & _
"<div class=""directions""><span class=""bold"">" & mName & "</span></div>"
& vbCrLf & _
"<div class=""directions""><span class=""bold"">" & mAddress1 &
"</span></div>" & vbCrLf & _
"<div class=""directions""><span class=""bold"">" & mAddress2 &
"</span></div>" & vbCrLf & _
"<div class=""directions""><span>&nbsp;</span></div>" & vbCrLf & _
"<div class=""directions""><span>" & mPhone1 & "</span></div>" & vbCrLf & _
"<div class=""directions""><span>" & mPhone2 & "</span><div>" & vbCrLf & _
"</fieldset>"
prt str5

str6 = "<div id=""linkhome""><span class=""linkhome""
onmouseover=""this.style.color='#00f'""
onmouseout=""this.style.color='#000'""
onclick=""location.href='/cart/cleanup.asp'""><img id=""continueimg""
src=""/cart/images/continue.gif"" /></span></div>" & vbCrLf & _
"</body>" & vbCrLf & _
"</html>"
prt str6

str7 = "</body>" & vbCrLf & _
"</html>"

writeReceipt cartid, str & str2 & str3 & str4 & str5 & str7

%>

If I put:
delXMLFile cartid
delSession cartid

....under writeReceipt at the bottom, then it fails most times with IE but
never with Firefox. It's ALL server-side code.
It processes those routines before it processes the conditional near the
top:

if session("ticket") = 0 or IsEmpty(session("ticket")) then
Response.Clear
Response.Redirect("/")
else
cartid = session("ticket")
end if

delSession cartid - sets the cartid to 0

str6, near the bottom has an onclick event which now goes to
/cart/cleanup.asp - This is what is in that file:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
%>
<!--#include virtual="/cart/nocache.asp"-->
<!--#include virtual="/cart/header.asp"-->
<%
cartid = session("ticket")
delXMLFile cartid
if Request.QueryString("id") = 1 then
delOrderXMLFile cartid
end if
delSession cartid
Response.Clear
Response.Redirect("/")
%>

Now that I've moved those two lines to this file, it works everytime in IE.
Is there something to the order of execution which will cause a call to a
subroutine in an included file to be processed before an inline conditional?
If not, then it's a bug or feature if you will because that is the ONLY way
I can see it happening.

How can this happen?

value = 44
if value = 0 or value = "" then
do this
end if
value = 0

In IE, the last statement is processed before the conditional.
In Firefox, it is processed in the order it was written.

Whether that is what is happening or not, those are the results. Someone
better and smarter than I needs to provide an answer as I cannot. I can
only provide the code and the results.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #15
Roland Hall wrote on 09 feb 2005 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
: so it is a clientside issue. ASP doesn't know or care what browser it
: sends his rendered html output to.

Which is why it doesn't make any sense. Why does IE fail and Firefox
work, everytime?
If that is rue, it is debugable.

As I said, I suspect it is a security settings issue.

:
: if session("ticket") = 0 or session("ticket")="" then
:
: will cover all possibilities.

So, session("ticket") = "" is equal to IsEmpty(session("ticket")) ?
I wouldn't know. There is no reason to use the second.
: session("ticket") = 0 can ony be returned if it was initialiszed
: somewhere else serverside.

It is initialized as 0 in the beginning, then it is set based upon the
ticket number given when the first item is added to the cart.
The receipt pages, which this issue happens, the very last line of
code calls for a sub(routine) which resets the value to 0.
ok, but then it is not a new session.
: > Response.Clear
: > Response.Redirect("/")
:
: Response.Clear is unnecessary before a redirect.
: Any cached html-to-be-sent will be deatroyed anyway.

Then there is a lot of misinformation because I have read
Response.Clear should be used if Response.Redirect is being called
inline.
"inline"? what do you mean?
: If html is already sent [by a response.flush?]

I tried using Response.Flush but with a Response.Redirect it has an
issue and after it is too late, at least on this page.
No, I mean that if Response.Flush is used, Response.Redirect is logically
and factually impossible, because of the below:
: Response.Clear cannot stop that and
: the Response.Redirect is invalid,
: as Response.Redirect sends a header instruction
: to the browser to redirect
: and cannot do that if the header is already sent.
:
: > else
: > cartid = session("ticket")
: > end if
: > get form values and assign them to variables
: > HTML code is written into strings using ASP - Ex. str = "<html>"...
: > ASP variables included where required.
:
: > As I need to write VBScript code
:
: Serverside? [also serverside Jscript is possible if you prefer]

No, I do not prefer JScript server-side.
As you wish, but there is no "need".
: > , I do that, then add another string
: > of HTML code, etc.
: > There are 7 strings
: > After the third, I grab the shopping cart from an XML file and put
: > the results into an array.
: > I loop through the array adding the purchased items to the receipt,
: > add more HTML code and write the string to the screen.
:
: Not to the server screen, surely?

How can a Response.Write write to the server screen?

I am referring to:
str = "blah blah blah"
Response.Write ("<div>" & str & "</div>" & vbCrLf)

in lieu of...

str = "blah blah blah"
%>
<div><%=str%></div>
No matter, that results in the same rendered html.
: You send the string as rendered html to the browser with a
: response.write?

see above

: > After the strings are assigned and written to the screen, I write
: > the receipt, passing the cart ID and the strings to a sub.
:
: Sorry, I cannot follow you here.

The receipt is a file:

str, str2, str3, str4, str5, str6 are written to the screen.
str, str2, str3, str4, str5, str7 are written to the receipt file.

Make sense yet?

str = "........."
Response.Write str

more vbs code

str2 = "......." & vbs var & "......"
Response.Write str2

... str7

writeReceipt cartid, str, str2, str3, str4, str5, str7

str6 has a button that is required for the shopper to click on but it
not needed in the receipt

:
: > At the end I have to subs,
:
: Sorry, I cannot follow you here.

Should have said 2 sub(routine)s

: > delete the cart file and set the session
: > number to 0.

delXMLFile cartid
delSession cartid

: What is a session number? Never heard of that.
: [If you mean session-id, do not touch that.]

cart session variable (cartid)

: > I believe since I'm buffering the page, and the receipt is being
: > written, the cart file delete and session initialization are
: > happening and then my test at the top is being performed so I
: > sometimes do not see the receipt.
:
: Session initialisation is done by the server system, before the
: sesrverside execution of the first page of a session begins. The
: server first examines the page request from the browser, and if there
: is no [valid] session-id cookie value, the ASP server starts a new
: session.

But that is not what is happening.

Here is a picture of the issue, forget everything else:

check cart id. If it is = 0 or empty, redirect the user to the home
page. ...
more code follows
...
' last 2 lines of code
delete the cart file
reset cartid to 0

The last line of code is being processed before the check cart id
above it because that is setting it to zero. I know it's happening
because when I remove the last 2 lines and put them in another file,
use the button click in "str6" to point to that file, which then runs
those routines and then redirects to the home page, it works every
time with every browser. However, Firefox worked every time the old
way. Yes, you, I and everyone else on the planet understand the
browser only works with what the server-side gives it but then the
browser shouldn't make a difference and it does. The browser cannot
change that value, so it has to be server-side and the last line is
the only place it is done on that page.
So it could be cookie acceptance?
I can only conclude that with Response.Buffer = True, that MSFT is
MSFT, what is that?
processing the whole page before it gives it to the browser, but it
appears to be processing external routines before inline conditionals.
Do you mean the ASP engine?
What external routines?
"Inline conditionals" to my mind are simply if..then clauses with the
true statement and the els statement on the same line.
I can't even believe I'm saying that but it appears to be what is
happening.
??
: You cannot do anything [like cart file delete] before session
: initialisation.

session variable re-initialization
session variable renaming?
: > Why Firefox doesn't have a problem with it or why it
: > works sometimes, is confusing. I removed the nocache include and
: > now it only fails after 3 successful ones for me.
so the page is cached then?
: > I've decided to take a different approach. After the receipt is
: > written, I call another page to cleanup and then redirect to the
: > home page. This effectively eliminates the issue and makes it
: > stable.
:
: > IE
: > apparently executes code on the page in some unknown order thus
: > making the last line of code excute before the some at the top.
:
: IE, firefox or any other browser do not execute ASP code at all!!!

I know which is why none of this makes any sense. When things are not
as they should be, then they are as they shouldn't be.
And you need to start debugging
: Do you perhaps mean clientside code?

Nope. Don't have any other than onclick events.
Onclick executes only clientside code.

: Do you have clientside vbscript?

Nope. All client-side code I write is javascript.

: [That will only be executed by IE and not by firefox.]

I'm aware. Ok, as if this is not long enough, I'm going to show you
the code for the mailinorder in a new page.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #16
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn*******************@194.109.133.29...
: Roland Hall wrote on 09 feb 2005 in
: microsoft.public.inetserver.asp.general:
:
: > "Evertjan." <ex**************@interxnl.net> wrote in message
: >: so it is a clientside issue. ASP doesn't know or care what browser it
: >: sends his rendered html output to.
: >
: > Which is why it doesn't make any sense. Why does IE fail and Firefox
: > work, everytime?
:
: If that is rue, it is debugable.

It's ridiculous that a client makes a difference to server-script!

: As I said, I suspect it is a security settings issue.

Since when does a security setting make something work sometimes and not
others?

: >:
: >: if session("ticket") = 0 or session("ticket")="" then
: >:
: >: will cover all possibilities.
: >
: > So, session("ticket") = "" is equal to IsEmpty(session("ticket")) ?
:
: I wouldn't know. There is no reason to use the second.

Then why do you think IsEmpty was created if it is never needed?

: >: session("ticket") = 0 can ony be returned if it was initialiszed
: >: somewhere else serverside.
: >
: > It is initialized as 0 in the beginning, then it is set based upon the
: > ticket number given when the first item is added to the cart.
: > The receipt pages, which this issue happens, the very last line of
: > code calls for a sub(routine) which resets the value to 0.
:
: ok, but then it is not a new session.

Semantics

: >: > Response.Clear
: >: > Response.Redirect("/")
: >:
: >: Response.Clear is unnecessary before a redirect.
: >: Any cached html-to-be-sent will be deatroyed anyway.
: >
: > Then there is a lot of misinformation because I have read
: > Response.Clear should be used if Response.Redirect is being called
: > inline.
:
: "inline"? what do you mean?

You don't know what inline code refers to? It's not in a function or a
subroutine. It's inline.

: >: If html is already sent [by a response.flush?]
: >
: > I tried using Response.Flush but with a Response.Redirect it has an
: > issue and after it is too late, at least on this page.
:
: No, I mean that if Response.Flush is used, Response.Redirect is logically
: and factually impossible, because of the below:
:
: >: Response.Clear cannot stop that and
: >: the Response.Redirect is invalid,
: >: as Response.Redirect sends a header instruction
: >: to the browser to redirect
: >: and cannot do that if the header is already sent.
: >:
: >: > else
: >: > cartid = session("ticket")
: >: > end if
: >: > get form values and assign them to variables
: >: > HTML code is written into strings using ASP - Ex. str = "<html>"...
: >: > ASP variables included where required.
: >:
: >: > As I need to write VBScript code
: >:
: >: Serverside? [also serverside Jscript is possible if you prefer]
: >
: > No, I do not prefer JScript server-side.
:
: As you wish, but there is no "need".

Is this really worth noting?

: >: > , I do that, then add another string
: >: > of HTML code, etc.
: >: > There are 7 strings
: >: > After the third, I grab the shopping cart from an XML file and put
: >: > the results into an array.
: >: > I loop through the array adding the purchased items to the receipt,
: >: > add more HTML code and write the string to the screen.
: >:
: >: Not to the server screen, surely?
: >
: > How can a Response.Write write to the server screen?
: >
: > I am referring to:
: > str = "blah blah blah"
: > Response.Write ("<div>" & str & "</div>" & vbCrLf)
: >
: > in lieu of...
: >
: > str = "blah blah blah"
: > %>
: > <div><%=str%></div>
:
: No matter, that results in the same rendered html.

But it effects the performance of the server differently.

: >: You send the string as rendered html to the browser with a
: >: response.write?
: >
: > see above
: >
: >: > After the strings are assigned and written to the screen, I write
: >: > the receipt, passing the cart ID and the strings to a sub.
: >:
: >: Sorry, I cannot follow you here.
: >
: > The receipt is a file:
: >
: > str, str2, str3, str4, str5, str6 are written to the screen.
: > str, str2, str3, str4, str5, str7 are written to the receipt file.
: >
: > Make sense yet?
: >
: > str = "........."
: > Response.Write str
: >
: > more vbs code
: >
: > str2 = "......." & vbs var & "......"
: > Response.Write str2
: >
: > ... str7
: >
: > writeReceipt cartid, str, str2, str3, str4, str5, str7
: >
: > str6 has a button that is required for the shopper to click on but it
: > not needed in the receipt
: >
: >:
: >: > At the end I have to subs,
: >:
: >: Sorry, I cannot follow you here.
: >
: > Should have said 2 sub(routine)s
: >
: >: > delete the cart file and set the session
: >: > number to 0.
: >
: > delXMLFile cartid
: > delSession cartid
: >
: >: What is a session number? Never heard of that.
: >: [If you mean session-id, do not touch that.]
: >
: > cart session variable (cartid)
: >
: >: > I believe since I'm buffering the page, and the receipt is being
: >: > written, the cart file delete and session initialization are
: >: > happening and then my test at the top is being performed so I
: >: > sometimes do not see the receipt.
: >:
: >: Session initialisation is done by the server system, before the
: >: sesrverside execution of the first page of a session begins. The
: >: server first examines the page request from the browser, and if there
: >: is no [valid] session-id cookie value, the ASP server starts a new
: >: session.
: >
: > But that is not what is happening.
: >
: > Here is a picture of the issue, forget everything else:
: >
: > check cart id. If it is = 0 or empty, redirect the user to the home
: > page. ...
: > more code follows
: > ...
: > ' last 2 lines of code
: > delete the cart file
: > reset cartid to 0
: >
: > The last line of code is being processed before the check cart id
: > above it because that is setting it to zero. I know it's happening
: > because when I remove the last 2 lines and put them in another file,
: > use the button click in "str6" to point to that file, which then runs
: > those routines and then redirects to the home page, it works every
: > time with every browser. However, Firefox worked every time the old
: > way. Yes, you, I and everyone else on the planet understand the
: > browser only works with what the server-side gives it but then the
: > browser shouldn't make a difference and it does. The browser cannot
: > change that value, so it has to be server-side and the last line is
: > the only place it is done on that page.
:
: So it could be cookie acceptance?

If it were a cookie acceptance then moving two subroutines to a different
page would have no effect on it. It also would not work sometimes and not
others.

: > I can only conclude that with Response.Buffer = True, that MSFT is
:
: MSFT, what is that?

The company that wrote the OS, the web server and the browser.

: > processing the whole page before it gives it to the browser, but it
: > appears to be processing external routines before inline conditionals.
:
: Do you mean the ASP engine?

Ya', the engine that processes the ASP code.

: What external routines?

If I include an asp page that has a routine, isn't that an external routine?

: "Inline conditionals" to my mind are simply if..then clauses with the
: true statement and the els statement on the same line.

Correct and my "external" routine is being processed prior to my "inline"
conditional at the top of the page. I've posted code. You don't have to
interpret my meanings.

: > I can't even believe I'm saying that but it appears to be what is
: > happening.
:
: ??
:
: >: You cannot do anything [like cart file delete] before session
: >: initialisation.
: >
: > session variable re-initialization
:
: session variable renaming?

No. Session variable re-initialization.
session("ticket") = 0
session("ticket") = getTickets
session("ticket") = 0

: >: > Why Firefox doesn't have a problem with it or why it
: >: > works sometimes, is confusing. I removed the nocache include and
: >: > now it only fails after 3 successful ones for me.
:
: so the page is cached then?

Cached/not cached, not much difference if it eventually fails without
modifying any code. My browser is not set for caching.

: >: > I've decided to take a different approach. After the receipt is
: >: > written, I call another page to cleanup and then redirect to the
: >: > home page. This effectively eliminates the issue and makes it
: >: > stable.
: >:
: >: > IE
: >: > apparently executes code on the page in some unknown order thus
: >: > making the last line of code excute before the some at the top.
: >:
: >: IE, firefox or any other browser do not execute ASP code at all!!!
: >
: > I know which is why none of this makes any sense. When things are not
: > as they should be, then they are as they shouldn't be.
:
: And you need to start debugging

As soon as MSFT sends me the source code, I'll do that.

: >: Do you perhaps mean clientside code?
: >
: > Nope. Don't have any other than onclick events.
:
: Onclick executes only clientside code.

Which is why I said that is all the client-side code I have.

: >: Do you have clientside vbscript?
: >
: > Nope. All client-side code I write is javascript.
: >
: >: [That will only be executed by IE and not by firefox.]
: >
: > I'm aware. Ok, as if this is not long enough, I'm going to show you
: > the code for the mailinorder in a new page.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #17
Roland Hall wrote on 10 feb 2005 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn*******************@194.109.133.29...
: Roland Hall wrote on 09 feb 2005 in
: microsoft.public.inetserver.asp.general: It's ridiculous that a client makes a difference to server-script!

: As I said, I suspect it is a security settings issue.

Since when does a security setting make something work sometimes and
not others?
No, but it is the only influence a browser can have on a serverside page,
because the browser sends a header with or without expected cookies [next
to other info] depending on its security settings, [which in turn could
depend on domain issues, so it could point to why one server acts
differently from another].
: > So, session("ticket") = "" is equal to IsEmpty(session("ticket")) ?
:
: I wouldn't know. There is no reason to use the second.

Then why do you think IsEmpty was created if it is never needed?
There is no reason to use the second _here_.

IsEmpty() is a bit of a misnomer, as it returns a Boolean value
indicating whether a variable has been initialized, and not if it
contains an empty string. it should have been called "IsInitialized()"

<%
response.write isempty(session("q")) 'True [first time in session only!]
response.write session("q")="" 'True
session("q")=""
response.write isempty(session("q")) 'False
response.write session("q")="" 'True
%>
: >: session("ticket") = 0 can ony be returned if it was initialiszed
: >: somewhere else serverside.
: >
: > It is initialized as 0 in the beginning, then it is set based upon
: > the ticket number given when the first item is added to the cart.
: > The receipt pages, which this issue happens, the very last line of
: > code calls for a sub(routine) which resets the value to 0.
:
: ok, but then it is not a new session.

Semantics
Sure, but if you ask us a question containing "new session" in this NG,
we could reasonabley assume a new ASP-session, where all session
variables are nonexistant to begin with.
: > Then there is a lot of misinformation because I have read
: > Response.Clear should be used if Response.Redirect is being called
: > inline.
:
: "inline"? what do you mean?

You don't know what inline code refers to? It's not in a function or
a subroutine. It's inline.
Oh, yes. But in the context of an asp page file, it also could mean code
in a html line like:

<div><% = myText %></div>

: >: If html is already sent [by a response.flush?]
: >
: > I tried using Response.Flush but with a Response.Redirect it has an
: > issue and after it is too late, at least on this page.
:
: No, I mean that if Response.Flush is used, Response.Redirect is
: logically and factually impossible, because of the below:
Comment?
: >:
: >: > As I need to write VBScript code
: >:
: >: Serverside? [also serverside Jscript is possible if you prefer]
: >
: > No, I do not prefer JScript server-side.
:
: As you wish, but there is no "need".

Is this really worth noting?
Since the sometime confusion of calling serverside coding VBscript and
clientside code Javascript, yes.
: > I am referring to:
: > str = "blah blah blah"
: > Response.Write ("<div>" & str & "</div>" & vbCrLf)
: >
: > in lieu of...
: >
: > str = "blah blah blah"
: > %>
: > <div><%=str%></div>
:
: No matter, that results in the same rendered html.

But it effects the performance of the server differently.
No, it does not significantly, I suspect,
as the resulting p-code will be the same.
: So it could be cookie acceptance?

If it were a cookie acceptance then moving two subroutines to a
different page would have no effect on it. It also would not work
sometimes and not others.
With the same logic you would not have your problem,
so don't dismiss any possible error sources till tested wrong.
: > I can only conclude that with Response.Buffer = True, that MSFT is
:
: MSFT, what is that?

The company that wrote the OS, the web server and the browser.
I thought you ment a programme.
: > processing the whole page before it gives it to the browser, but it
: > appears to be processing external routines before inline
: > conditionals.
:
: Do you mean the ASP engine?

Ya', the engine that processes the ASP code.

: What external routines?

If I include an asp page that has a routine, isn't that an external
routine?
No it is not. <!--#include..> simply includes the ascii text of a file in
the text of the file to be executed by the asp-engine before the
executing.

Usually with "external routine" a routine executed with another engine or
another instance of the same engine is ment.

This is important, because the latter can give rise to errors like the
ones you expect, but the former, which is what is happening, does not.
: "Inline conditionals" to my mind are simply if..then clauses with the
: true statement and the els statement on the same line.

Correct and my "external" routine is being processed prior to my
"inline" conditional at the top of the page.
Impossible, since see above,
it is just text inserted before the asp-execution.

if myInclude.asp contains:
<% a = "No" %>

then

<% a = "Yes" %>
<!--#include file ="myInclude.asp"-->
<% response.write a %>

will write "No".

because it results in exactly the same p-code as does:

<% a = "Yes" %>
<% a = "No" %>
<% response.write a %>

and the viewsourceable html code sent to the client will both be:

No

=======

If you mean by "[external] routine" a sub or function in that include
file, that will only be executed, if and when called.

However the "inline" code of the <include will execute immediately on the
asp engine reaching that row in the resulting text
[well, the p-code version that is.]
: > session variable re-initialization
:
: session variable renaming?

No. Session variable re-initialization.
session("ticket") = 0
session("ticket") = getTickets
session("ticket") = 0
Yes, I concede.
: >: > Why Firefox doesn't have a problem with it or why it
: >: > works sometimes, is confusing. I removed the nocache include
: >: > and now it only fails after 3 successful ones for me.
:
: so the page is cached then?

Cached/not cached, not much difference if it eventually fails without
modifying any code. My browser is not set for caching.
Sure it differs.
Clientside caching precludes the [re]execution of the serverside code,
so if the recalling of a clientside cached page giving an error must be a
cllientside error.
: And you need to start debugging

As soon as MSFT sends me the source code, I'll do that.


Debugging YOUR code.

The probability that your code malfunctions is far greater than a asp-
engine failure.

Did you viewsource the resulting HTML?

Did you set serverside "breakpoints" showing values at several points of
your code?

<%
.........
response.write "<br>myPresentValue = " & myPresentValue & "<br>"
response.end
.........
%>

If you still doubt the action of an <include>, dit you insert the exact
text of that include file instead of that <include> line in a testversion
of the main .asp page?

That is what I mean by debugging.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Flemming Jensen | last post by:
The idea behind this code is to standardize all my webpages in an application to look the same by inheriting the pages from a userdefined class. But it gives me problems regarding sessionstate... ...
2
by: mike parr | last post by:
I want to use cookies on my website, simply to identify the user when they come to my website (I will just be writing one for new users and reading from people who are already users when they reach...
5
by: Mikko Penkkimäki | last post by:
Hi Looks like I can not change Web page's timeout setting. In practise it's all the time 20 minutes - no matter what I do. I have this kind of setting in web.config: <sessionState...
3
by: Ralf Müller | last post by:
hi all! in my custom HttpHandler HttpContext.Current.Session is not set - why? greetings, ralf
2
by: ivanL | last post by:
In web.config, I can set SessionState mode to "Off" while using Forms authentication, they have 2 diff mechanisms, is this correct?
4
by: jensen bredal | last post by:
Hello, i was not able to find any documentation about the largest value one can assign the "timeout" attribute of the <sessionState section in web.config. any idea?
2
by: Philipp Schumann | last post by:
....BUT for _custom_ HttpHandlers. How can I do that? In my custom IHttpHandler, HttpContext.Current.Session is a null reference, and I can't use the session state. It is enabled in web.config...
7
by: Krishnan | last post by:
Hi, Could anyone please let me know how to read SessionState setting from the Web.Config file into an ASPNET application? TIA Krishnan
0
by: Mr Ideas Man | last post by:
Hi all, Relating to a post i made earlier... I am deploying a asp.net app to my web host. They assure me that the directory i am copying my files to is configured as an IIS Application. ...
0
by: Med | last post by:
Hi, My Settings in web.config: <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1; Trusted_Connection=yes"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.