Session("userCount")=0 in Application_Start - Session State is not available ....

Dear Experts

I followed the video tutorial No.2 that demonstrates no of users accessing the website at a given moment. In the global.aspx on Application_Start i have intialized a session variable as follows
Session("userCount")=0
and am incrementing this in Session_Start event as follows
Session("userCount") +=1

When i debug and run the application i get the following error

Server Error in '/SessionTest' Applicaiton. Session state is not available in this context (in the Application_Start Event)

When i hit the refresh button a couple of times it works. but open another window the count remains the same.Please help

Thanks

 

0
standman007
12/11/2006 7:26:11 AM
asp.net.state-management 8807 articles. 0 followers. Follow

2 Replies
992 Views

Similar Articles

[PageSpeed] 49
Get it on Google Play
Get it on Apple App Store

Hi,

When the application starts, no session is available. so you will get error when first request the page which will couse the Application_Start to fire.

I've never seen that demo, but i think they should use Application instead of Session, because session is user-specific. 

Application["UserCount"] = 0;

Application["UserCount"] += 1;

Hope it helps.

0
raymond
12/11/2006 7:54:54 AM

Thanks raymond.wen

Thanks for your help. I am so sorry. it is application and NOT session in the Video. i must have been drunk when watching it. but thanks raymond. and sorry bob.

best regards

manish 

 

0
standman007
12/11/2006 12:57:24 PM
Reply:

Similar Artilces:

superreview granted: [Bug 278951] Accessible "state" and "extended state" have been mixed up : [Attachment 171841] patch v2
Henry Jia <Henry.Jia@sun.com> has granted Louie Zhao <Louie.Zhao@sun.com>'s request for superreview: Bug 278951: Accessible "state" and "extended state" have been mixed up https://bugzilla.mozilla.org/show_bug.cgi?id=278951 Attachment 171841: patch v2 https://bugzilla.mozilla.org/attachment.cgi?id=171841&action=edit ...

State is not "new" after changing "assigned to"
Hi, If i change the "assigned to" field for the bug, the bug used to change to the state NEW, but lately it does not do that anymore. Possibly because of an update? Thats very annoying, cause people don't notice the bugs then, if they don't get them as NEW. What can i do about it? Is there a setting for that? Thanks, Franz Rosner Is there really absolutely no solution for this? regards, Franz Rosner Am Thu, 4 Jun 2009 15:39:33 +0200 schrieb Franz Rosner: > Hi, > > If i change the "assigned to" field for the bug, the bug ...

superreview requested: [Bug 241055] nsHTMLTextFieldAccessible need "ATK_STATE_EDITABLE" state and "Activate" action. : [Attachment 176575] add editable state
Aaron Leventhal <aaronleventhal@moonset.net> has asked Mike Shaver (gmail, please do not cc or assign) <mike.shaver@gmail.com> for superreview: Bug 241055: nsHTMLTextFieldAccessible need "ATK_STATE_EDITABLE" state and "Activate" action. https://bugzilla.mozilla.org/show_bug.cgi?id=241055 Attachment 176575: add editable state https://bugzilla.mozilla.org/attachment.cgi?id=176575&action=edit ------- Additional Comments from Aaron Leventhal <aaronleventhal@moonset.net> Actually this patch is fixing a different problem than the first page. ...

superreview granted: [Bug 241055] nsHTMLTextFieldAccessible need "ATK_STATE_EDITABLE" state and "Activate" action. : [Attachment 176575] add editable state
Henry Jia <Henry.Jia@sun.com> has granted Louie Zhao <Louie.Zhao@sun.com>'s request for superreview: Bug 241055: nsHTMLTextFieldAccessible need "ATK_STATE_EDITABLE" state and "Activate" action. https://bugzilla.mozilla.org/show_bug.cgi?id=241055 Attachment 176575: add editable state https://bugzilla.mozilla.org/attachment.cgi?id=176575&action=edit ...

superreview requested: [Bug 241055] nsHTMLTextFieldAccessible need "ATK_STATE_EDITABLE" state and "Activate" action. : [Attachment 176575] add editable state #2
Louie Zhao <Louie.Zhao@sun.com> has asked Henry Jia <Henry.Jia@sun.com> for superreview: Bug 241055: nsHTMLTextFieldAccessible need "ATK_STATE_EDITABLE" state and "Activate" action. https://bugzilla.mozilla.org/show_bug.cgi?id=241055 Attachment 176575: add editable state https://bugzilla.mozilla.org/attachment.cgi?id=176575&action=edit ...

Printer in "Not Available" state
Hello! We have one XP PC which has problems printing to NDPS printers. The NDPS printers are configured correctly, other PCs don't have problems with printing to these printers. On this PC, the printers are distributed correctly, however, the printer status of all NDPS printers automatically changes between "Ready" and "Not Available". It's very regular: 15 seconds "Ready", 45 seconds "Not Available". In the "Not Available" state it's sometimes possible to print, but sometimes it isn't. Non-NDPS printers don'...

superreview granted: [Bug 437009] buttons with type="radio" or type="checkbox" render with the incorrect state when checked : [Attachment 327953] handle <button> checked/open states
Vladimir Vukicevic (:vlad) <vladimir@pobox.com> has granted Kai Liu <kliu@mozilla.kailiu.com>'s request for superreview: Bug 437009: buttons with type="radio" or type="checkbox" render with the incorrect state when checked https://bugzilla.mozilla.org/show_bug.cgi?id=437009 Attachment 327953: handle <button> checked/open states https://bugzilla.mozilla.org/attachment.cgi?id=327953&action=edit ------- Additional Comments from Vladimir Vukicevic (:vlad) <vladimir@pobox.com> Hrm, wonder how we didn't catch this before. I think ...

superreview requested: [Bug 437009] buttons with type="radio" or type="checkbox" render with the incorrect state when checked : [Attachment 327953] handle <button> checked/open states
Kai Liu <kliu@mozilla.kailiu.com> has asked Vladimir Vukicevic (:vlad) <vladimir@pobox.com> for superreview: Bug 437009: buttons with type="radio" or type="checkbox" render with the incorrect state when checked https://bugzilla.mozilla.org/show_bug.cgi?id=437009 Attachment 327953: handle <button> checked/open states https://bugzilla.mozilla.org/attachment.cgi?id=327953&action=edit ...

Swap a "1" or "0" for a "Y" or "N"
I have a sql query that returns rows of data and one field returns a 1 (which means yes) or a 0 (which means no).  On my vb.net page, how do I replace the 1 with a Yes and the 0 with a No?  Or do I do this in the sql?  How do I do this in sql?Never make important decisions on a Monday! By default, VB.Net can understand 1 as Yes and 0 as No.I believe you are using those DB values for your Boolean Operations.Try to use If <DBValue> then <Operation>. If you are really need Yes/No .... Declare boolean variable in VB.net and set those variables. Thanks and R...

Novell 5.0 SP 6 Replica "Join State 0"
Good day. The NDS tree is running only 5.0 SP6. It is partitioned in regional and then sites with regional servers holding the masters of the region and the sites. A merge on a site partition has gone bad. The site replicas show "on" but the regional show "Join". All aborts have failed. TID's I found indicate only Novell can fix this. Anybody got any ideas? Thanx. deon.oosthuizen@sita.co.za, First thing to do is to perform a NDS Health Check on the servers, so that we can get the error holding this operation up. Depending on what the error is, we migh...

ODBC error "Program type out of range" , SQL State S1003 : PB6.0--->MS SQL Server7.0 on WIN NT4.0
Hi, I have installed SQL Server 7.0 Standard Ed. on Windows NT 4.0 with Service Pack 4. Then I installed Power Builder 6.0 Enterprise Ed. on the same server machine NT 4.0 + SQL Server 7.0 After defining an ODBC DSN and Profile in PB 6.0, when i try to connect from within Profile setup, it connects to the SQL Server 7.0 Database. But when i click on the Tables or Database icons on the toolbar to open the DB or tables, I get an error message like SQLSTATE =S1003 [MICROSOFT] [ODBC DRIVER MANAGER] Program Type Out of Range The same type of profile & ODBC settings on the W...

How to trap "System.Web.HttpException" "state information is invalid"?
I received the following error while testing an ASP 3.5 application.  I think this might be caused by a time-out or by using the back-button.      System.Web.HttpException: The state information is invalid for this page and might be corrupted. I searched the forum and didn't find a definitive reason for this error or a bullet-proof method for preventing it from happening.  So I would like to deal with it gracefully when it occurs, so that the users do not see it.  I would like to trap the error, preventing it from displaying to the use...

Is there a quick a dirty way of achieving border="0" cellpadding="0" cellspacing="0" for html tables?
As the question states... I have HTML tables all over the place and really want to avoid having to manually add border="0" cellpadding="0" cellspacing="0" for each of them, can I override this in CSS?   Any help would be greatly appreciated. Thanks. Declare a css class for the table with all these properties initialized. That will do the workThanks & RegardsJacobMark As Answer if this post Helped you  Yes, define a class in css:.table { padding: 0px; border: 0px; } The only trick will be adding class="table" to the...

OldValuesParameterFormatString "{0}" vs "original_{0}"
Hi All, found myself between a rock and hard place.My aspx/vb.net page has a GridView (edit and delete enabled) which has an ObjectDataSource (ODS_Admin) as it's datasource.ODS_Admin is linked to a tableAdapter (admin.xsd) to which I've added custom queries for updating/deleting/inserting.My problem is that when OldValuesParameterFormatString="original_{0}" in the ODS, the update button/query works but the delete does not.Error Delete click:ObjectDataSource 'ODS_Admin' could not find a non-generic method 'DeleteQuery' that has parameters: D_ID...

thunderbird 2.0.0.14 "today" "yesterday" "two weeks ago" "old mail"
Name: chris hinkle Email: chrisatchrishinkledotcom Product: Thunderbird Summary: thunderbird 2.0.0.14 "today" "yesterday" "two weeks ago" "old mail" Comments: what the? if your going to put something as annoying as telling me when the emails groupings were sent AT LEAST make it something that is changeable/customizable as I can SEE when they were sent, I do not need or like them grouped in this fashion - I find it extremely annoying...please make all future updates and this asap with full customizable layouts thank you chris ...

Web resources about - Session("userCount")=0 in Application_Start - Session State is not available .... - asp.net.state-management

Resources last updated: 12/5/2015 7:44:39 PM