473,668 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1811
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******** ******@TK2MSFTN GP14.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 EnableSessionSt ate = false. But i would rather use Session from ASP.NET

George.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message news:Ox******** ******@TK2MSFTN GP15.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP14.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 EnableSessionSt ate = 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******** ******@TK2MSFTN GP10.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
EnableSessionSt ate = false. But i would rather use Session from ASP.NET

George.

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:Ox******** ******@TK2MSFTN GP15.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******** ******@TK2MSFTN GP14.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
3305
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 and a couple "better pratice" code. Not perfect, but better. Problem : I'm testing everything with Firefox on my machine (IIS on WinXP Pro), and everything is ok. As soon as I try MS IE 6, it doesn't seem to keep the sessions from page to...
3
1960
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 done. I am talking about controlling the loading of those images themselves. I was told that the only way to do this was to dynamically write the html code via javascript and put time delays inbetween the dynamic creation of that html such as:
7
4192
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 code for 6 hours and stops. I've found the problem to be the Set MySession = CreateObject("MAPI.Session")
2
2515
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
1761
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 tried pass session id through url (like in cookieless mode). But this dosen't work. I know that this works in Java.while application is configured in cookie mode. How to do this in ASP.Net? How to access application session without
1
1456
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 create and increment the Session variable: To create it: Session.add("Right",0) To increment it: Session("Right")=Session("Right")+1
7
2036
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, it retreives the Menu from session and assigns its reference to Menu1. Within the Page_Load event I can see its internal values which have been retreived for each menu item and so it looks good. However, when the Render method is called of...
7
4246
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 static void GetSessions() { HttpContext ctx = HttpContext.Current; ctx.Session; // not available. <undefined value>
1
2278
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) cookie is created to hold the session key for the user. This unique key is assigned as part of the business layer logon process, and never changes while the user is logged on. The call to the business component returns this unique key if the logon...
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8799
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8586
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2026
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.