delayed session creation

G

George

Hi, Is it possible to delay session creation in ASP.NET

I want the user to browse my site without any session created (no cookies set). My pages will know that is Session = null then Session has not been created and they should not rely on it.

But at the moment user puts something into shopping cart i want to trigger session creation (set the cookies) and from no own that user will have regular session.

Is it doable with .NET Session or i will have to create my own Session object?


Thanks
George.
 
K

Kevin Spencer

Hi George,

Session is always there. Think of it as a box. It doesn't have anything IN
it until you PUT something in it. In addition, Session cookies are not saved
as a file on the client machine. They exist (in memory) only for the
lifetime of the client Session on your web site. They expire immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

Hi, Is it possible to delay session creation in ASP.NET

I want the user to browse my site without any session created (no cookies
set). My pages will know that is Session = null then Session has not been
created and they should not rely on it.

But at the moment user puts something into shopping cart i want to trigger
session creation (set the cookies) and from no own that user will have
regular session.

Is it doable with .NET Session or i will have to create my own Session
object?


Thanks
George.
 
G

George

You misunderstood me,
I am very well aware how session works.

I do not want it to be created since it eats memory in my server and any malicious code hitting my box 1000 times a second will bring it down because my memory will be full of empty Sessions (boxes as you said)

All i want is somehow postpone the Session creation untill i need it( basically user want to put something into shopping cart).

All is needed is that ASP did not create session automaticly and sent the cookie back to the computer.
So the question is how can i do it with ASP.NET

PS: I always can have my custom Session object created and have on every page EnableSessionState = false. But i would rather use Session from ASP.NET

George.

Hi George,

Session is always there. Think of it as a box. It doesn't have anything IN
it until you PUT something in it. In addition, Session cookies are not saved
as a file on the client machine. They exist (in memory) only for the
lifetime of the client Session on your web site. They expire immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

Hi, Is it possible to delay session creation in ASP.NET

I want the user to browse my site without any session created (no cookies
set). My pages will know that is Session = null then Session has not been
created and they should not rely on it.

But at the moment user puts something into shopping cart i want to trigger
session creation (set the cookies) and from no own that user will have
regular session.

Is it doable with .NET Session or i will have to create my own Session
object?


Thanks
George.
 
B

Bruce Barker

this is not builtin. you need to write your own, or as a hack, on end request call session.abandon(), whenever you don't want to keep the session (just put a keep flag in the session). this will keep the memory footprint down.

but if you are doing a true shopping cart app, i would not use inproc sessions (too easy to the lose cart). i'd use a database and allow the cart to survive for days.


-- bruce (sqlwork.com)

Hi, Is it possible to delay session creation in ASP.NET

I want the user to browse my site without any session created (no cookies set). My pages will know that is Session = null then Session has not been created and they should not rely on it.

But at the moment user puts something into shopping cart i want to trigger session creation (set the cookies) and from no own that user will have regular session.

Is it doable with .NET Session or i will have to create my own Session object?


Thanks
George.
 
T

Tom.PesterDELETETHISSS

Hi,

Is this realy an issue? Do you have an idea of the memory sessions consume
that don't get used?

I haven't encountered a problem with this but I dont have 1000's of visitors.

Cheers,
Tom Pester
 
J

Juan T. Llibre

re:
PS: I always can have my custom Session object created
and have on every page EnableSessionState = false.

You answered your own question.

Disable SessionState on all the initial pages,
and enable SessionState at the point you want to.

You could also have an entry point in an application which
uses cookieless mode, and redirect to a cookie-enabled
application when you need it.






You misunderstood me,
I am very well aware how session works.

I do not want it to be created since it eats memory in my server and any malicious code
hitting my box 1000 times a second will bring it down because my memory will be full of
empty Sessions (boxes as you said)

All i want is somehow postpone the Session creation untill i need it( basically user want
to put something into shopping cart).

All is needed is that ASP did not create session automaticly and sent the cookie back to
the computer.
So the question is how can i do it with ASP.NET

PS: I always can have my custom Session object created and have on every page
EnableSessionState = false. But i would rather use Session from ASP.NET

George.

Hi George,

Session is always there. Think of it as a box. It doesn't have anything IN
it until you PUT something in it. In addition, Session cookies are not saved
as a file on the client machine. They exist (in memory) only for the
lifetime of the client Session on your web site. They expire immediately.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Ambiguity has a certain quality to it.

Hi, Is it possible to delay session creation in ASP.NET

I want the user to browse my site without any session created (no cookies
set). My pages will know that is Session = null then Session has not been
created and they should not rely on it.

But at the moment user puts something into shopping cart i want to trigger
session creation (set the cookies) and from no own that user will have
regular session.

Is it doable with .NET Session or i will have to create my own Session
object?


Thanks
George.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top