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

Help on session behaviour ???

Dear all

I have a strange behaviour using session.

ON my form load when the page is first display I create a session variable
to stor connection objects as follow :

If not IsPostBack then Then
Session.Add("DataLayer", Me.m_pCon)
else
Me.m_pCon.m_dbConnection = CType(Session("DataLayer"),
DbConParam).m_dbConnection

end if

Time to time it appears that the session object is not existing anymore,
then I retry 2 or 3 times and its again working

Any ideas why it occurs like this ?

regards
serge
Jan 20 '06 #1
3 1074
The session has a timeout that is set in the web.config. I think the default
timeout is 20 minutes.
Therefore you can never rely on that the object you put into session still
exists when you recieve a post back of a page.

Hope this helps,
mortb
"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:0D**********************************@microsof t.com...
Dear all

I have a strange behaviour using session.

ON my form load when the page is first display I create a session variable
to stor connection objects as follow :

If not IsPostBack then Then
Session.Add("DataLayer", Me.m_pCon)
else
Me.m_pCon.m_dbConnection = CType(Session("DataLayer"),
DbConParam).m_dbConnection

end if

Time to time it appears that the session object is not existing anymore,
then I retry 2 or 3 times and its again working

Any ideas why it occurs like this ?

regards
serge

Jan 20 '06 #2
So that means that I should always test if object is nothing when a post back
is received and then if object is nithing reinitialise it ?
"mortb" wrote:
The session has a timeout that is set in the web.config. I think the default
timeout is 20 minutes.
Therefore you can never rely on that the object you put into session still
exists when you recieve a post back of a page.

Hope this helps,
mortb
"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:0D**********************************@microsof t.com...
Dear all

I have a strange behaviour using session.

ON my form load when the page is first display I create a session variable
to stor connection objects as follow :

If not IsPostBack then Then
Session.Add("DataLayer", Me.m_pCon)
else
Me.m_pCon.m_dbConnection = CType(Session("DataLayer"),
DbConParam).m_dbConnection

end if

Time to time it appears that the session object is not existing anymore,
then I retry 2 or 3 times and its again working

Any ideas why it occurs like this ?

regards
serge


Jan 20 '06 #3
Hi Serge,

See my comments following
If not IsPostBack then Then
Session.Add("DataLayer", Me.m_pCon)


Do you init Me.m_pCon? If not it's Nothing. When postback, you retrieve
nothing from Session.

HTH

Elton Wang
Jan 20 '06 #4

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

Similar topics

1
by: Jenny | last post by:
Need urgent help for an unsolved problem. In our ASP web application, we creat a Back button and if user click on this button, it execute history.go(-1) to go back to the previous page. All our...
3
by: Martin | last post by:
Hi all As my posting title suggests I'm having problems using InProc Session state in my ASP .NET app. I wrote a site for a friend which uses ADO .NET to keep track of a simple...
1
by: RUSSELL MCGINNIS | last post by:
I have a web site that uses Form Authentication with the Session timeout set to 20 minutes, however one of the pages refreshes itself every 30 seconds. Is there a way to override the session...
4
by: T Ralya | last post by:
I am told that ASP.NET controls the session ID and session variables, but that does not fit my symptoms. I am posting here as directed. I'm hoping that someone can at least recommend something to...
4
by: Aidas Pasilis | last post by:
I'm saving some values to the Session state and get some strange results. To be short I'll write example code and standart behavior: Code Example:...
7
by: Victor | last post by:
I've got two domain names sharing the same IP address that use ASP VBScript If I set a session variable with domain 1, it is only available for domain 1 - this is correct? If I set an...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
6
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= | last post by:
Hi Our application was using Session variables to store business object for our Web Forms successfully until someone opened a cloned IE window using Control-N key press. The cloned window...
11
Dormilich
by: Dormilich | last post by:
recently I encounter a very strange behaviour of the session variable. if the cookies are disabled, the session id is totally misplaced (see code). instead being attached to the URL it is placed...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.