Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6787605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:23:10+00:00 2026-05-26T17:23:10+00:00

plz see my global.asax : using System; using System.Collections.Generic; using System.Linq; using System.Web; using

  • 0

plz see my global.asax :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using DataLayer;
using NiceFileExplorer.Classes;
using System.IO;
using System.Text;
using System.Data;
using System.Web.Hosting;

namespace NiceFileExplorer
{

    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            Application["OnlineUsers"] = 0;
        }

        protected void Session_Start(object sender, EventArgs e)
        {
            Application.Lock();

            OnlineUsers.InsertRow(
                Session.SessionID,
                DateTime.Now, //Session Start Time
                DBNull.Value, //Session End Time
                true);

            //OnlineUsers Is A Table In MS SQL SERVER 2008  

            //InsertRow  Is A StoredProcedure Of OnlineUsers Table Like Below :  


//    ALTER Procedure [dbo].[sp_OnlineUsers_Insert]
//    @Session_ID nvarchar(300),
//    @Session_Start datetime,
//    @Session_End datetime = NULL,
//    @Online bit
//As
//Begin
//    Insert Into OnlineUsers
//        ([Session_ID],[Session_Start],[Session_End],[Online])
//    Values
//        (@Session_ID,@Session_Start,@Session_End,@Online)

//    Declare @ReferenceID int
//    Select @ReferenceID = @@IDENTITY

//    Return @ReferenceID

//End

            Application["OnlineUsers"] = (int)Application["OnlineUsers"] + 1;
            Application.UnLock();
        }

        protected void Session_End(object sender, EventArgs e)
        {
            Application.Lock();

            OnlineUsers.UpdateRow_Some_Fields_By_SessionID(
                Session.SessionID,
                DateTime.Now,
                false);

//UpdateRow_Some_Fields_By_SessionID Is A StoredProcedure Of OnlineUsers Table Like Below :  

//    ALTER Procedure [dbo].[sp_OnlineUsers_Update_Some_Fields_By_SessionID]
//    @Session_ID nvarchar(300),
//    @Session_End datetime,
//    @Online bit
//As
//Begin
//    Update OnlineUsers
//    Set
//        [Session_End] = @Session_End,
//        [Online] = @Online
//    Where     
//        [Session_ID] = @Session_ID

//End

            Application["OnlineUsers"] = (int)Application["OnlineUsers"] - 1;
            Application.UnLock();
        }

        protected void Application_End(object sender, EventArgs e)
        {

        }

    }
}

i have to labels in my project for showing OnlineUsers!

1 is using :

Application["OnlineUsers"].ToString();

2 is using :

OnlineUsers.Count_Users().ToString();

    //Count_Users Is A StoredProcedure Of OnlineUsers Like Below :  
    //ALTER Procedure [dbo].[sp_OnlineUsers_Count]
    //    As
    //    Begin
    //        Select 
    //            [Session_ID],
    //            [Session_Start],
    //            [Session_End],
    //            [Online]
    //        From OnlineUsers
    //        Where 
    //            [Online] = 1

    //        Declare @Count int
    //        Select @Count = @@ROWCOUNT

    //        Return @Count
    //    End

SomeTimes Lable 1 Shows Us : 5
but Lable 2 Shows Us : 255

what did i do wrong about them ?
why there is a big difference between them?

EDIT
my sessionState in web.config is like this :

<sessionState mode="InProc" cookieless="false" timeout="1" />

thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:23:11+00:00Added an answer on May 26, 2026 at 5:23 pm

    Session_End is only fired when the session times out, so that’s why the counts don’t match. Try using Session.IsNewSession to key off your Session_End logic instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

plz see the below handler : using System; using System.Collections.Generic; using System.Linq; using System.Web;
plz guide me how I can enable or disable asp.net validation controls using jQuery
plz see the below link : Long File Name Inside A Div when you
plz see the below codes : 1 2 3 +1+ $(document).ready(function() { //Do Some
plz see the aspx below first : <div id=divFilesBody> <div class=divFilesBody_Row> <%= Files %>
plz see the below html : <head runat=server> <title></title> <style type=text/css> html, body {
am getting this error when i open my site in internet explorer......... plz help
I wanted to write following query through codeigniter's db helper class, guide me plz
I can't see anything on here but I do remember being told that If
i do get an Integrity constraint violation for Doctrine though i really can't see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.