Click here to Skip to main content
15,867,828 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: AddHandler and RemoveHandler Pin
Shameel28-Aug-12 15:06
professionalShameel28-Aug-12 15:06 
QuestionControlling No. of Loggeed users Pin
SPSandy26-Aug-12 22:49
SPSandy26-Aug-12 22:49 
AnswerRe: Controlling No. of Loggeed users Pin
Eddy Vluggen27-Aug-12 0:12
professionalEddy Vluggen27-Aug-12 0:12 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy27-Aug-12 6:42
SPSandy27-Aug-12 6:42 
GeneralRe: Controlling No. of Loggeed users Pin
Eddy Vluggen27-Aug-12 8:01
professionalEddy Vluggen27-Aug-12 8:01 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy28-Aug-12 6:48
SPSandy28-Aug-12 6:48 
GeneralRe: Controlling No. of Loggeed users Pin
Eddy Vluggen28-Aug-12 8:05
professionalEddy Vluggen28-Aug-12 8:05 
AnswerRe: Controlling No. of Loggeed users Pin
pramod.hegde27-Aug-12 3:28
professionalpramod.hegde27-Aug-12 3:28 
You need to handle it in Global.asax file. If you observe, this class inherits HttpApplication which has a property HttpApplicationState. So you can set a variable LoggedInUsers in ApplicationSate when the application starts (Application_Start method) and you can keep updating the variable in Session_Start & Session_End methods.

C#
void Application_Start(object sender, EventArgs e)
{
    // Code that runs on application startup
    Application["LoggedInUsers"] = 0;
}
void Session_Start(object sender, EventArgs e)
{
    // Code that runs when a new session is started
    Application.Lock();
    Application["LoggedInUsers"] = (int)Application["LoggedInUsers"] + 1;
    Application.UnLock();
}

void Session_End(object sender, EventArgs e)
{
    // Code that runs when a session ends. 
    // Note: The Session_End event is raised only when the sessionstate mode
    // is set to InProc in the Web.config file. If session mode is set to StateServer 
    // or SQLServer, the event is not raised.
    Application.Lock();
    Application["LoggedInUsers"] = (int)Application["LoggedInUsers"] - 1;
    Application.UnLock();
}

GeneralRe: Controlling No. of Loggeed users Pin
SPSandy27-Aug-12 6:46
SPSandy27-Aug-12 6:46 
GeneralRe: Controlling No. of Loggeed users Pin
pramod.hegde27-Aug-12 6:52
professionalpramod.hegde27-Aug-12 6:52 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy28-Aug-12 6:49
SPSandy28-Aug-12 6:49 
QuestionSOAP Data: How to Convert Different Datatypes? Pin
Sonhospa24-Aug-12 1:47
Sonhospa24-Aug-12 1:47 
AnswerRe: SOAP Data: How to Convert Different Datatypes? Pin
Abhinav S24-Aug-12 2:15
Abhinav S24-Aug-12 2:15 
GeneralRe: SOAP Data: How to Convert Different Datatypes? Pin
Sonhospa24-Aug-12 2:55
Sonhospa24-Aug-12 2:55 
QuestionToo many Connections in MySQL Pin
SPSandy23-Aug-12 22:41
SPSandy23-Aug-12 22:41 
AnswerRe: Too many Connections in MySQL Pin
David Mujica24-Aug-12 2:10
David Mujica24-Aug-12 2:10 
GeneralRe: Too many Connections in MySQL Pin
Dave Kreskowiak24-Aug-12 4:26
mveDave Kreskowiak24-Aug-12 4:26 
GeneralRe: Too many Connections in MySQL Pin
SPSandy24-Aug-12 6:41
SPSandy24-Aug-12 6:41 
GeneralRe: Too many Connections in MySQL Pin
Dave Kreskowiak24-Aug-12 9:47
mveDave Kreskowiak24-Aug-12 9:47 
AnswerRe: Too many Connections in MySQL Pin
Eddy Vluggen25-Aug-12 6:23
professionalEddy Vluggen25-Aug-12 6:23 
GeneralBatch program Pin
David Mujica24-Aug-12 10:23
David Mujica24-Aug-12 10:23 
GeneralRe: Too many Connections in MySQL Pin
SPSandy24-Aug-12 6:34
SPSandy24-Aug-12 6:34 
AnswerRe: Too many Connections in MySQL Pin
Dave Kreskowiak24-Aug-12 4:23
mveDave Kreskowiak24-Aug-12 4:23 
QuestionWhat is the Visual Basic Code...this is urgent Pin
Member 937845723-Aug-12 15:31
Member 937845723-Aug-12 15:31 
AnswerRe: What is the Visual Basic Code...this is urgent Pin
Wes Aday23-Aug-12 16:00
professionalWes Aday23-Aug-12 16:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.