473,386 Members | 2,042 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,386 software developers and data experts.

Session_Start/End Question

My intent is to write some information to a database when a new session of
my application begins. The code that writes to the database works great -
however the Session_Start procedure (in Global.asax.cs) is run for each page
requested. Specifically, what I'm observing is that when I start the
application via VS.NET 2003 (default.aspx), and then immediately navigate
via the browser to another page, and then immediately to another, I get one
entry in the database for each page opened. Stepping through at runtime
verifies that Session_Start is being called when each successive page is
opened. While I may be misunderstanding exectly when a session starts and
stops, I doubt a new session is supposed to start for every page requested.

I would appreciate it if someone could explain what ASP.NET considers to be
a session - when it starts, when it stops, etc.

Thanks.
Nov 18 '05 #1
2 1404
A session begins when a user requests a page for the first
time from your application and ends either when your
application explicitly closes the session or when the
session times out.

Normally, the session will not timeout immediately. Do you
have any code deliberately close the session? such as
Session.Abandon()

Bin Song, MCP
-----Original Message-----
My intent is to write some information to a database when a new session ofmy application begins. The code that writes to the database works great -however the Session_Start procedure (in Global.asax.cs) is run for each pagerequested. Specifically, what I'm observing is that when I start theapplication via VS.NET 2003 (default.aspx), and then immediately navigatevia the browser to another page, and then immediately to another, I get oneentry in the database for each page opened. Stepping through at runtimeverifies that Session_Start is being called when each successive page isopened. While I may be misunderstanding exectly when a session starts andstops, I doubt a new session is supposed to start for every page requested.
I would appreciate it if someone could explain what ASP.NET considers to bea session - when it starts, when it stops, etc.

Thanks.
.

Nov 18 '05 #2
Nope - no code to explicitly abandon the session, and no apparent reason the
sessions should time out immediately. Does the fact that I'm developing and
testing on the same machine have any relevance here?

I read the fine manual and understand what you pointed out - that "a session
begins when a user requests a page for the first time...". All the books
and online help say the same thing - that's why I'm a bit confused on this
one.

Jeff
"Bin Song" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
A session begins when a user requests a page for the first
time from your application and ends either when your
application explicitly closes the session or when the
session times out.

Normally, the session will not timeout immediately. Do you
have any code deliberately close the session? such as
Session.Abandon()

Bin Song, MCP
-----Original Message-----
My intent is to write some information to a database when

a new session of
my application begins. The code that writes to the

database works great -
however the Session_Start procedure (in Global.asax.cs)

is run for each page
requested. Specifically, what I'm observing is that when

I start the
application via VS.NET 2003 (default.aspx), and then

immediately navigate
via the browser to another page, and then immediately to

another, I get one
entry in the database for each page opened. Stepping

through at runtime
verifies that Session_Start is being called when each

successive page is
opened. While I may be misunderstanding exectly when a

session starts and
stops, I doubt a new session is supposed to start for

every page requested.

I would appreciate it if someone could explain what

ASP.NET considers to be
a session - when it starts, when it stops, etc.

Thanks.
.

Nov 18 '05 #3

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

Similar topics

2
by: Reply-Via-Newsgroup Thanks | last post by:
Folks, I consider myself a reasonably strong PHP programmer, but I've not used sessions before (I've used cookies instead) and I'd appreciate it if someone could confirm something for me. ...
1
by: Mercy | last post by:
Hi, I'm a newbie. I was trying to figure out how to use the Session_start method? The reference books I'm reading say that a session STARTS when "session_start" is called. But ... in their sample...
6
by: Jeff Smythe | last post by:
Why does Session_Start in Global.asax fire for every page opened during a session of an ASP.NET application? Am I wrong to expect that it would fire only when the first page (i.e., any page in...
5
by: Niklas Uhlin | last post by:
Someone please explain why Session_Start fires multiple times / retains SessionID values between sessions, when you open an ASP.NET page from MS Word. For details of the problem, see below: 1....
4
by: csn | last post by:
Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events? We have code in both events, with try-catch blocks, and if an exception is caught, we...
5
by: Gabriel Lozano-Morán | last post by:
Is there any particular reason why the Session_Start() event gets triggerend by each aspx page request? Details: Windows XP Pro SP2 ..NET Framework v1.1.4322 C# SessionState set to mode...
4
by: Joe Befumo | last post by:
I'm workinbg in Visual Studio 2003. I'm experimenting with creating a session variable, and from all I can gather. the Session_Start event is not firing. In Global.asx.vb, in the Session Start...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
6
by: Alex | last post by:
Hello All, I'm having a problem with global.asax file. The session_start method of globals.asax.vb is not firing in my project when I copy the files to a production server. It works OK in my...
4
by: three-eight-hotel | last post by:
I'm somewhat of a newbie to PHP coding, but have developed a site using the technology, and have been pleasantly surprised by the capabilities offered. I am more comfortable in the ASP world,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.