Session is timing out on the drop down selected index change RRS feed

  • Question

  • User-1676238594 posted

    Hello Everyone,

    I am facing a weird problem here. I have a report page on which i am using a drop down list which has different years. When user select the year=2009, i am displaying report for 2009 data. The code is given below. The website is live on our web server now. The page access havy data, so sometime it takes one minute or more to load the report for selected year and when that is the case my session expires and user is getting redirected to the default page. But the same thing works fine in the solution in my machine and in one of our local server. It is just not working on our live server. Please help me by posting the solutions if you know any.

    I have also placed this line in my web.config but it is not helping:

      <sessionState mode="InProc" timeout="140" />


       protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e)
                if (Session["UserId"] != null)
                    Session["IsDetailedReportLoaded"] = false;
                    Session["IsScoreCardLoaded"] = false;
                    Session["IsChartLoaded"] = false;
                    Session["IsReportLoaded"] = false;

                    string strYear = ddlYear.SelectedValue;
                    lblYear.Text = strYear;
                    lblAsOf.Text = strYear;           
                    lblYear.Text = ddlYear.SelectedValue.ToString();
                    lblAsOf.Text = ddlYear.SelectedValue.ToString();
                    ddlYearDetail.SelectedValue = ddlYear.SelectedValue;
                    ddlYearScorecard.SelectedValue = ddlYear.SelectedValue;
                    ddlYearGraph.SelectedValue = ddlYear.SelectedValue;



    Satish k.

    Tuesday, September 6, 2011 2:36 PM

All replies

  • User731747087 posted

    It is not going to work even if you increase duration for session timeout. This is clearly database related problem.


    I suspect this is related to

    a. SQL Statement - Check your SQL statement and the records being produced from your development environment. Then point the same SQL statement in your production environment. Verify using a parameter that works on both environment. Then check it with a parameter that would normally result to session timeout.

    b. Incorrect data in production environment - incorrect data such duplicate records will increase the time to retrieve records. It has the same effect if your SQL statement will produce dupicate keys that is being used in a join statement.

    I hope I have given you a clue / hint. If you have any follow up questions, bring them on

    Tuesday, September 6, 2011 11:46 PM
  • User-448512826 posted

    check how to set session ..



    Thursday, September 8, 2011 3:49 AM
  • User-1177472553 posted

    i think this has nothing to do with session, 

    did u set the CommandTimeOut Property of SQLCommand class ?

    Thursday, September 8, 2011 12:09 PM
  • User1867929564 posted

    Slow query is different issue.
    is this really database problem ?
     if (Session["UserId"] != null)




    i suggest you to compare ur local iis with server iis.

    Tuesday, September 13, 2011 3:40 AM
  • User731747087 posted

    It should be easy to isolate if this is database or database record problem. Just fire the same query in I/SQL pointing to

    a. development database

    b. production database

    Time each execution and check the number of records returned. This will give you some idea where the real bottleneck is

    Wednesday, September 14, 2011 10:43 AM
  • User-1363023537 posted

    <sessionState mode="InProc" timeout="140" />

    As you are storing the session data inside the process there are possibilities like when worker process becomes unhealthey
    due to 60% or more memory utilization it Reactively kills itself and create new instance of worker process where you don't have your previous session values.
    Try to store the session out of process useing MS SQL server or State server.


    Application pool and worker process


    Wednesday, September 14, 2011 12:56 PM
  • User-1199946673 posted

    when that is the case my session expires and user is getting redirected to the default page

    Are you using Forms Authentication? Bevause when you do, be aware thet when a session expires, this doesn't mean that the forms authentication ticket expires, because this is stored in a cookie....

    Wednesday, September 14, 2011 1:45 PM