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

I would like to...

.... reward the one that can show me how to use an array to keep track of the
active sessions (session-ids, logontimes, etc) in my ASP.Net application. Of
course I can't reward anyone here, but still... Aren't there anyone of you
clever guys that can show me how to do this? Anyone..?

I can't find help on this issue anywhere.
Please help me,
Christina

Nov 18 '05 #1
6 1470
check your previous post

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@mail.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...
... reward the one that can show me how to use an array to keep track of the active sessions (session-ids, logontimes, etc) in my ASP.Net application. Of course I can't reward anyone here, but still... Aren't there anyone of you
clever guys that can show me how to do this? Anyone..?

I can't find help on this issue anywhere.
Please help me,
Christina

Nov 18 '05 #2
Why an array? Just write the info to a DB with each session_start and clear
it in the session_end
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Christina N" <no@mail.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...
... reward the one that can show me how to use an array to keep track of
the
active sessions (session-ids, logontimes, etc) in my ASP.Net application.
Of
course I can't reward anyone here, but still... Aren't there anyone of you
clever guys that can show me how to do this? Anyone..?

I can't find help on this issue anywhere.
Please help me,
Christina

Nov 18 '05 #3
But I need to be able to query the array to find out for how long the
different sessions have been inactive. That's my main challenge in this
matter..
Can you help me?

Christina
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:eA***************@tk2msftngp13.phx.gbl...
Why an array? Just write the info to a DB with each session_start and clear it in the session_end
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Christina N" <no@mail.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...
... reward the one that can show me how to use an array to keep track of
the
active sessions (session-ids, logontimes, etc) in my ASP.Net application. Of
course I can't reward anyone here, but still... Aren't there anyone of you clever guys that can show me how to do this? Anyone..?

I can't find help on this issue anywhere.
Please help me,
Christina


Nov 18 '05 #4
as i showed you in my reply to your last post you can add user at
session_start

similarly you can query the user specific info like say the last access data
time by using set the coding in
Application_BeginRequest.
get your user specific object and update it with the current time

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:eU**************@TK2MSFTNGP11.phx.gbl...
check your previous post

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"Christina N" <no@mail.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...
... reward the one that can show me how to use an array to keep track of the
active sessions (session-ids, logontimes, etc) in my ASP.Net application. Of
course I can't reward anyone here, but still... Aren't there anyone of

you clever guys that can show me how to do this? Anyone..?

I can't find help on this issue anywhere.
Please help me,
Christina


Nov 18 '05 #5
You're prefect! Thanx :) *hugs*

Christina

"Bill Borg" <Bi******@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
Can't fault your persistence. This is not a complete solution, but here are some thoughts (vb syntax).

1. Create a class to store the elements of each session you want to save, e.g.
Public Class MySession

Private m_SessionID As String
Public Property SessionID() As String
Get
Return m_SessionID
End Get
Set(ByVal Value As String)
m_SessionID = Value
End Set
End Property

Private m_loginTime As DateTime
Public Property LoginTime() As DateTime
Get
Return m_loginTime
End Get
Set(ByVal Value As DateTime)
m_loginTime = Value
End Set
End Property

End Class

2. Create a property at the global application level to store your list of
sessions. Using arraylist is one way. I'd probably do this right within
global.asax, e.g.

Private m_Sessions As ArrayList
Public ReadOnly Property MySessions() As ArrayList
Get
If IsNothing(m_Sessions) Then
m_Sessions = New ArrayList
End If
Return m_Sessions
End Get
End Property

3. When each session starts (I'd use global.asax), create a new instance of MySession (see above), fill the values with whatever, and add to the global list, e.g.

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Create a new Session holder.
Dim mySession As New MySession
mySession.SessionID = Session.SessionID
mySession.LoginTime = Date.Now
MySessions.Add(mySession)
End Sub

4. When each session ends, use Session ID to find it in the global list and remove the MySession entry.

A few warnings:

a. I think that a module-level variable (my arraylist) is a poor way to
persist the list. My understanding is that ApplicationStart only fires once for the application, but within that the application might choose to fire up multiple instances of the actual httpapplication class, which would give you multiple instances of your arraylist (each would then only have some portion of the list). Better probably to use Application state or Cache (or persist to disk if you want a permanent record).

b. SessionEnd does not happen as fast as you might want. By default, a
session only times out after a user is gone for 20 minutes, so your list
might contain more entries than people who are actually connected. Might not be a problem in your case, or you can give people a way to sign out and do
session.abandon.

c. ApplicationEnd can happen in a variety of ways that you might not expect (not just when all the sessions have finally ended). For one, ApplicationEnd happens if you make a change to a shadowed file (e.g. web.config,
global.asax, etc.). In this case, the application ends all sessions, goes
down, brings itself back up, and restarts the sessions as each guy does
something again. The users don't know the difference, it's just that if
you're looking at session start times, for example, you might see a real
recent start time for a guy you "think" has been on all day.

I ran the above and it worked as expected: start a bunch of sessions, go get the arraylist in MySessions (cast context.applicationinstance to "global" and you can get at your new public property of global), and when you dump out the list in each session you see all the sessions. As I said above, there's
probably a better way to persist the arraylist.

There are a number of people out here who understand this stuff very, very
well. I'm hoping if I've gotten any of this wrong above that they'll jump in. Have fun.

hth,

Bill

Nov 18 '05 #6
While using a database in a web farm is more scalable, using memory versus
arrays is definitely a plus in terms of performance. On a non-web-farm web,
I would go with an array or Collection (Collection would be better, as you
can easily add and remove items).

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:eA*************@tk2msftngp13.phx.gbl...
Why an array? Just write the info to a DB with each session_start and clear it in the session_end
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Christina N" <no@mail.com> wrote in message
news:Ob*************@tk2msftngp13.phx.gbl...
... reward the one that can show me how to use an array to keep track of
the
active sessions (session-ids, logontimes, etc) in my ASP.Net application. Of
course I can't reward anyone here, but still... Aren't there anyone of you clever guys that can show me how to do this? Anyone..?

I can't find help on this issue anywhere.
Please help me,
Christina


Nov 18 '05 #7

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

Similar topics

6
by: tomek | last post by:
What should I write after sql like for finding hole words and not for words in string sequence. I tryied "like space variable space" but it's not working for me. Database is MYSQL.
1
by: Mooky Mooksgill | last post by:
I would like to search a table for a phrase, or for a partial phrase, eg on table product - for name or description, or name + descprition. How does one say select * from product where name +...
7
by: Michael Beumers | last post by:
Hello NG I've defined a cursor like the following in my COBOL Programm: DECLARE testc CURSOR FOR SELECT ... FROM ... WHERE field1 LIKE :hostvariable1 field2 LIKE :hostvariable2
4
by: Tom Walker | last post by:
I cannot get the WHERE statement to work correctly unless I use a literal with the LIKE. I want to use a working storage data name so that I can vary the WHERE statement. Example that works: ...
5
by: Steve | last post by:
Hello, I currently have a query that takes it's criteria from a form. All works well except when a name is mis-spelled in the database. My thought was to try to use the "like" command as part of...
11
by: ynott | last post by:
Novice here obviously. Anyway, I'm a bit confused about how to approach this. I have a query against a table that I'm trying to create. I'm trying to view all streets.type values that are null,...
9
by: Nathan Sokalski | last post by:
I am trying to do a database search using LIKE using the following code: Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click If...
2
by: Ed Brown | last post by:
I'm working on a VB.Net application that needs to do quite a bit of string pattern matching, and am having problems using the "LIKE" operator to match the same string twice in the pattern. For...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
11
by: Dan Sugalski | last post by:
Is there any good way to speed up SQL that uses like and has placeholders? Here's the scoop. I've got a system that uses a lot of pre-generated SQL with placeholders in it. At runtime these SQL...
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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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...
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
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,...

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.