473,659 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sessions of non-authenticated users expire en masse

Here's some weirdness for you. I thought I'd be clever and track
user's sessions. Application_Sta rt creates a DataTable and dumps it in
the Application object. Then in Session_Start I put some stuff in it:

Application.Loc k();
DataTable objUserTable = (DataTable)Appl ication["UserTable"];
DataRow objRow = objUserTable.Ne wRow();
Guid objGuid = Guid.NewGuid();
objRow[0] = objGuid;
Session["PfSessionI D"] = objRow[0];
objRow[1] = 0;
objRow[2] = false;
objUserTable.Ro ws.Add(objRow);
Application["UserTable"] = objUserTable;
Application.UnL ock();

In Session_End I nuke the row:

Application.Loc k();
DataTable objUserTable = (DataTable)Appl ication["UserTable"];
objUserTable.Ro ws.Find((Guid)S ession["PfSessionI D"]).Delete();
Application["UserTable"] = objUserTable;
Application.UnL ock();

Because I want to know when it's a specific user who's on, I check
them out here in Application_OnA cquireRequestSt ate:

Application.Loc k();
if (Request.IsAuth enticated)
{
HttpContext context = HttpContext.Cur rent;
DataTable objUserTable = (DataTable)Appl ication["UserTable"];
People objPeople = new People(context. User.Identity.N ame);
foreach (DataRow Item in objUserTable.Se lect("SessionID = '" +
((Guid)Session["PfSessionI D"]).ToString() + "'"))
Item.Delete();
if (objPeople.Peop leID != 0)
{
foreach (DataRow Item in objUserTable.Se lect("PeopleID = " +
objPeople.Peopl eID.ToString()) )
Item.Delete();
}
DataRow objRow = objUserTable.Ne wRow();
objRow[0] = Session["PfSessionI D"];
objRow[1] = objPeople.Peopl eID;
objRow[2] = objPeople.ShowD etail;
objUserTable.Ro ws.Add(objRow);
Application["UserTable"] = objUserTable;
}
Application.UnL ock();

The People object has its PeopleID set to 0 if for some reason no user
record is found (from cache or DB), and that's the value given to any
request not authenticated.

Here's the weirdness though... the values in the table that have a 0
value in Row[1] (the PeopleID) all vaporize about every ten minutes
then slowly build back up to the number of non-authenticated users. I
can't for the life of me figure out why.
Nov 17 '05 #1
0 854

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

Similar topics

6
7199
by: Chewy509 | last post by:
Hi Everyone, I'll just start, and say I am not a PHP developer (I'm a sysadmin, who has gotten lumped with a non-working website). But since I like to do this type of stuff, I though I might just learn WTF is going on? :) Basically, sessions are being created, but no info in being stored in the session, and if data is stored (about 1 in 20 goes), it doesn't follow-on on a page redirect.
0
2143
by: Alex | last post by:
I'm running Apache 2.0.47, PHP 4.3.3 on RedHat 9.0 on a new server. I have a series of pages that let's say pages 1 -> 3 are non-ssl and 4-8 are SSL but the URL domain is different (shared SSL). The client clicks through them from one to another in order using forms and URLs with GET vars. The client starts a non-ssl session on pg. 1 using www.mydomain.com. When they get to pg. 3, a hyperlink with an SSL URL and session ID as a GET...
13
12036
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location on the server (in our own accounts on the same machine). When I am testing both versions of our program using the same browser (IE on Windows or Konqueror on Linux) the session variables will mix up and only the latest selection or options will...
1
1739
by: Shawn Wilson | last post by:
Hi, I've been having some trouble with sessions. I have a pw-protected section of my website where members can log in and use tools to edit their websites. The problem is sessions seem to disappear at random. I can't seem to isolate a particular set of circumstances under which this happens. I realize this is a vague problem, but does anyone have any tips as to how I could go about isolating the cause? I'm open to wild guesses :o)
5
8530
by: Ikke | last post by:
I have to share a variable between browser sessions. One session for example changes the variable, the other sessions must see the changes (get the new value instead of the original value) it's not allowed to save the value in a database or to save it into a file. It must be a kind of global server variable, changeable by every session. tia
6
3784
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
2
3680
by: Chris Mahoney | last post by:
Hi I'm using several Sessions in my app. When the user has cookies enabled in their browser, everything works fine. But with cookies disabled, only IE seems to remember the sessions. In Firefox and Safari, the session values seem to be "forgotten". I've looked around on Google but can't find any solutions to this problem. Plus I don't know how debug with Firefox (eg. step through the code).
2
2400
by: Cesar Ronchese | last post by:
Hello, I'm experiencing a very weird problem. I have a ASP.Net 2005 application (VB.Net) that creates some folders to store temporary files. example: Session_Start(...) IO.Directory.CreateDirectory(Server.MapPath(".") & "\SessionFolders\" & Session.SessionID) (...) The same application holds a session object that logs on to my server application (desktop - non ASP), that shows all connected clients in a listview. See sample code:
9
1579
by: dino d. | last post by:
Hi Everyone- I was reading a few posts about sessions and security, and it seems that the best way to address sessions security is to require authentication every time the user needs to get to sensitive data (or protect the session data with SSL). In other words, assume that the world can see your session data stored in cookies if you're not using SSL. So, I started looking for exceptions to this rule of thumb (requiring...
26
7920
by: Bookham Measures | last post by:
Hello We are planning to set-up a load balanced web environment. Accordingly, we are going to change the session management on our website from the classic ASP Session State and session variables, to a database method. Does any one have any pointers as to how I might approach this, so that I can have the same sort of functionality the ASP sessions give without having to create database columns for each session variable I wish to...
0
8427
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8332
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8525
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
8627
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
7356
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 projectplanning, coding, testing, and deploymentwithout 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...
1
6179
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2750
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
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.