Re: ASP sessionstate

From: Evertjan. (exjxw.hannivoort_at_interxnl.net)
Date: 02/09/05


Date: 09 Feb 2005 09:02:40 GMT

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)


Relevant Pages

  • Re: Desperate Help Needed
    ... hundred K of output HTML. ... The queries take no time at all to execute, it is the sending the data to ... ASP for years with big pages. ... > basically buffers all the output on the server and then send it in one go. ...
    (microsoft.public.inetserver.iis)
  • session_start problems among other things?
    ... The third party has a shopping cart which must be saved in the ... the hosted server that we do not see on our internal development ... save and restore the cart to the session so as to concentrate the ... ASP.NET APIs could be called from ASP pages but the development was ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: asp question about post vars
    ... > I've had a couple people tell me that I need to do query strings and pass ... PostBack, store data in Session (or Application, depending upon the scope ... uses Session space on the server to store the data. ... > applications that were written in php with an ASP alternative. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Treeviews
    ... On one side there is ASP, PHP, JSP. ... > server side code that executes to extract data base stuff. ... > html in ways that make then inseparable. ... You CAN intermingle client side ...
    (comp.lang.cobol)
  • Re: asp problem in IIS5.1
    ... > I have windows XP with IIS 5.1. ... > with HTML Pages.but it is not working with ASP pages. ... > Server Application Error ...
    (microsoft.public.inetserver.asp.components)