Saturday, March 24, 2012

Loop thru All Session Variables for All users on site

How would I Loop thruAll Session Variables forAllusers on my site?

Perhaps in Global.asax?

Thanks

I had kept this link in my favorites, however I don't know how much it will be of help to you...

http://www.eggheadcafe.com/articles/hijacksession.asp


Thanks for replying.

That application does not apply to my sitauation.


Its not possible in InProc mode. You can use SQL Server to store session state, however this offers reduced performance. The only way is to save each session as it starts into a database and then loop through the database!

This is accessable in the global.asax file (as you said) in the session_on_start (or simular).

Thanks,


I am sure that asp.net stores all the session variables somewhere in the system.

The only question is how to access that info.


I believe session is a function of IIS - not asp.net, asp.net just takes advantage of this feature.

If not stored externally, via sql server, then the session variables are stored in process memory of the server.

I don't believe there is a physical place on the system, just virtual in the server memory.


There is multiple places to store sessions:

InProc (in process)

StateServer

SQL Server

or custom. In Process is obviously the hardest to get at!!- hence my previous post about SessionOnCreated


If it is in IIS it should be accessible.

I am sure that all the session info is stored somewhere by IIS or asp.net.

Can you do a bit of research to find where all the session info is stored?

I would greatly appreciate it.

Thanks


By default its stored within the worker process W3... something! Hence the name InProcess! It can be stored within SQL as ive suggested!


HiYzidell,

I think that DavidKiff said is correct, you can configure your application and store session in SQL Server. For more information, seeHOW TO: Configure SQL Server to Store ASP.NET Session State.

I hope this helps.


Maybe you can try this one:

For every user added, put something like this:

Session["user"]=(int)Session["user"]+1;

Then to loop all users added, use this:

int num=(int)Session["user"];

for (int x=0; x<num; x++)

{

//additional logic here

}

Hope that helps!

0 comments:

Post a Comment