You must Sign In to post a response.
  • Category: ASP.NET

    About Session.Start and Page.Load

    Hi,I am working on asp.net,my doubts is in Page.Load,Session.Start, Application.BeginRequest,which one will execute first and next,suppose i have 10 Session using in my application then how many times Session.begion will execute?
    can any one will answer my question pls
  • #730441
    Application_BeginRequest of global.asax file will be executed when the first request to your web application is raised after your web site is hosted. After this event for every request from each unique user Session_Start event will be fired.
    Page_Load event of a page is fired when .aspx page is requested. For Example: Page_Load event of Default.aspx page is raised when Default.aspx page is requested by the user.

    For every user a new unique session will be created on the server. For Example: If you open the website from the same browser session(one browser window different tabs) only one session is created but if you open the site from a new browser window then a new session is created.

    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • #730443
    Hi ramana,

    First off all Application will start when first user make request after that session will start when new user make request.

    When Application starts…..?

    Application started automatically when first user make a request

    When Session starts….?

    When new user make a request session will starts.

    When Pool starts…?

    When IIS will starts pool started.

    When pool ends…?

    When IIS will end pool ended.

    When Session ends….?

    Idle time 20 min's session will end.

    When Application ends…?

    All sessions are ended then Application end.


    Refer below link for more details..

    http://www.dotnetspider.com/resources/45165-Calculate-Online-users-Total-Users-ASP.net.aspx

    Hope this will help you to resolve the issue..

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #730454
    Hi,

    All the events like Session_Start or Session_End or Application_Start or Application_End etc will be present in Global.asax

    You can use Global.asax file when you want executed any specific code that need to be executed when ever new session starts or ends or when application starts etc.

    Global.aspx (Global Application class) contains the following events:

    protected void Application_Start(object sender, EventArgs e)
    {
    //Executes when application starts and this event will be executed only once.
    }

    protected void Session_Start(object sender, EventArgs e)
    {
    //Executes when a new session starts
    }

    protected void Application_BeginRequest(object sender, EventArgs e)
    {
    //Use when you want do something when application begins
    }

    protected void Application_AuthenticateRequest(object sender, EventArgs e)
    {
    //Use when you want to athenticate the request
    }

    protected void Application_Error(object sender, EventArgs e)
    {
    //Use when you want to log errors when any unhandled exectiption occurs
    }

    protected void Session_End(object sender, EventArgs e)
    {
    //Executes when session ends
    }

    protected void Application_End(object sender, EventArgs e)
    {
    //Executes when application ends, usually calls this while doing maintainance
    }
    You can use above events, based on your requirements.

  • #730491
    There is no session begin event exist, instead there is Session_Start event, which call on login every new browser create new session id.

    Application_BeginRequest method is executed on all requests handled by the ASP.NET runtime.
    On a local server, it requires about one fifth of a millisecond to execute, and most of that time is spent in the Render method.

    Session_end event is called when either session time is collapsed or we call Sesssion.Abandon() method

    Page_Load event call when we load a page, according to page_life cycle this event is call on each postback or server request

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


  • Sign In to post your comments