473,385 Members | 1,676 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,385 software developers and data experts.

delayed session creation

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.
Nov 19 '05 #1
5 1801
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.

"George" <no****@hotmail.com> wrote in message
news:ui**************@TK2MSFTNGP14.phx.gbl...
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.
Nov 19 '05 #2
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.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message news:Ox**************@TK2MSFTNGP15.phx.gbl...
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.

"George" <no****@hotmail.com> wrote in message
news:ui**************@TK2MSFTNGP14.phx.gbl...
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.
Nov 19 '05 #3
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)

"George" <no****@hotmail.com> wrote in message news:ui**************@TK2MSFTNGP14.phx.gbl...
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.
Nov 19 '05 #4
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
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.

Nov 19 '05 #5
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.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espanol
Ven, y hablemos de ASP.NET...
======================

"George" <no****@hotmail.com> wrote in message
news:uV**************@TK2MSFTNGP10.phx.gbl...
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.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Ox**************@TK2MSFTNGP15.phx.gbl...
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.

"George" <no****@hotmail.com> wrote in message
news:ui**************@TK2MSFTNGP14.phx.gbl...
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.

Nov 19 '05 #6

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

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
3
by: stan k. | last post by:
First of all let me clarify - I am not talking about having a bunch of images loaded all at once (or preloaded) and then controlling the display of the images after that point -- I know that can be...
7
by: Ottar | last post by:
I've made a program sorting incomming mail in public folder. The function runs every minute by using the form.timer event. In Access XP it runs for weeks, no problem. Access 2003 runs the same...
2
by: Naina Mohamed | last post by:
I have abandon a session in my page and navigate to some other page thro' Redirect method, but i am getting old session id in the navigated page. How to get new session variable in navigated page
3
by: nn | last post by:
Hello I have ASP.Net application configured to use cookies for session. For some reasons I can't move to cookieless model. I need access to session created in this application without cookie. I...
1
by: Nathan Sokalski | last post by:
I am trying to increment the Session variable at certain points in my code, but it will not work. The initial value assigned to it is always the one that is displayed. Here is the code used to...
7
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below,...
7
by: Hardy Wang | last post by:
Hi, I have a web application, code of ASPX page needs to call one static method in another class which does not inherit System.UI.Page class using System.Web; public class Utils { public...
1
by: AnthonyC | last post by:
I am having a problem tracking down what I believe to be a problem with the way cookies are being used on our website application. When user log onto the application, an in-memory (per-session)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.