.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

SQL Server Session state problem.

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

Hi to all,

I have some things that I want to know. I am right now using a free asp.net webhosting ("somee.com"). The problem is that when I am visiting a page, there's a tendency that values stored in my session variables are lost. Therefore, it causes an error when the requested page is loaded.

1. I am thinking of using sessionState mode="SqlServer". Will it solve my problem?

Actualy Im working on it but Im having problems when connecting to the sql database.

2.  Is that a problem in the webhost?

3. Do free webhosting sites provide allow session state in the sql server?. Because ive tried it locally into my computer and error say's i should intall the ASP.NET Session State SQL Server version 2.0 or above.

View Complete Post

More Related Resource Links

Session State Problem




I just for the first time into a session state problem. So I am hoping someone

here has the answer.


I have written an ASP.Net website and tried to implement the common poor mans online user count.
The problem I am having is the following.

On App_Start I create a variable and assign it the value of 0;

Then increase the number on session_start and decrement on session_end.

On my local IIS it works perfectly from IE8 and Opera. The value increments correctly.
As soon as I upload to my live server. The value increments on every link I click and every page refresh when I test with IE8.
This does not happen when testing with Opera.

Could someone please shed some light on the subject.




Louis Lews

WCF session client service reference "State" is not updated when the server side has closed


I am using vb.net (Visual Studio 2008 with framework 3.5). I have a server that exposes several services requiring sessions. I am using wsHttpBinding for all. One of my requirements is to allow non-dot net third parties to access these services. When a client connects to a service and then some time later the server goes away, the state of the connection is still reporting "open".

Currently I have implemented a "ping" function on the server. My client calls this function every 5 to 10 seconds and if the server does shutdown, I get alerted with an exception error. This works, but I was wondering if there is a way where I don't have to call my ping function?

I don't want to use a dual connection binding and I was hoping to use the connection state variable? But, I don't know how to get it to update by itself. The client user application could just wait until it goes to invoke a service method, but I was wondering if there was another way.

Thanks in advance!!


using Session state server



My ASP.NET web application is hosted in multiple servers  with a Network Load balancer Hardware. I am facing issues in session management during the site navigation. Frequently the session values are lost and application errors out with session not found. Currently the Site is configured with the Session mode as Inproc.

I would like to know:

1. Whether changing the Session mode to State server will solve the session management issue.
2. If changing the session mode then what would be the best configuration for the state server.
3. Is there any other configuration settings that needs to be done in the State server as well as in the application

Thank you

state server for session.



  i studied like state server retrieve the session if the web server restarts.

here my doubt is application will not work while webserver restarts.then what is the use of retrieve the session after restrart the webserver?

Could not use session state server on windows 2008 R2



I am now migrating a ASP.NET web pages (.NET 2.0) to Windows 2008 R2, started IIS, SMTP, ASP.NET state server on the same machine.

Originally I have such setting on web.config, which is OK on windows server 2003.

<sessionState mode="StateServer" stateConnectionString="tcpip=" sqlConnectionString="data source=;Trusted_Connection=yes" cookieless="false" timeout="20"/>

On windows 2008 R2:

On IIS, I defined that as an Application and under  "Default Web Site", and defined a new applicaiton pool to it.

On "Default Web site", I define the session to use "InProc" and the application as "InProc", everything works fine, however, when I change the application to use "StateServer", the follow error happens:

Sample error detail:

Event code: 3009
Event message: Unable to make the session state request to the session state server. Details: last phase='Reading response from the state server', error code=0x8000FFFF, size of outgoing data=0
Event time: 10/21/2010 2:28:48 PM
Event time (UTC): 10/21/2010 6:28:48 AM
Event ID: 85f567a2371448678bf90eff3942fe62
Event sequence: 4
Event occurrence: 1
Event detail

ASP.NET version 2.0 session state not installed on SQL Server


The fix for this error message is to run aspnet_regsql -ssadd. I have run that uptown, downtown and in my lady's chamber and it does no good, although it never complains. Are there any other possibilities?


IIS Server: v5.1 running on XP.

SQLServer 2005 running on a different XP box.

Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618

There is an ASPState database on the server, containing only two tables: ASPStateTempApplications and ASPStateTempSessions. I did not use -sstype when I ran aspnet_regsql.


Session state problem


Hi All,

          I have 2 cols. StartTime and EndTime. If user's total time is greater then 30 mins then I am locking user. Here, I used Session and I want keep my session for 30 mins. I did almost everything (I think ?) . Change the setting from IIS, Wrote <sessionState timeout="30"> but it is not working... Till 28 - 29 mins it saves the time, but not above..... After that I changed the session's timeout for 9 hours ex: <sessionstate timeout="5400">..... But still not working.... I don't understant what to do?


anybody know the solution?




Session Lost Even SQL Server State


Good luck to everyone.

Imagine A project has been in the medium-sized scale contents classes in the sessions,

the SQL Server sessions seriliazed. 300-minute session in the state here;

but it losts when they dont till 300 minutes.

there are a lot of solution on the Internet, but most are guaranteed by SQL Server State and it cant be change anything.
in the meantime i havent any vps or vds just using low hosting packet web farm or web garden dont know.

by the way i had try another solution named "Defibilator" think a iframe on page and refresh every 60 second for extends session timeout. [didnt work either]

Do you think the problem is ?


 easy to come to you.


p.s : sorry for my bad english

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Custom Server Control Property not maintaining state


I have created a server control consisting of a TextArea and a div under it.  My goal is to create my own asp:TextArea type control.  the div is for a Character count of the text area and seems to work ok but i added a CharacterCountVisible property to the control that is always returning true.  See Proptery definition below


<Bindable(False), Category("Appearance"), DefaultValue("True"), Localizable(True)> Property CharacterCountVisible() As Boolean
        Return _CountBoxVisible
    End Get
    Set(ByVal value As Boolean)
        _CountBoxVisible = value
    End Set
End Property

Note the _CountBoxVisible variable is define inside the class as :

Dim _CountBoxVisible as Boolean = True

What I am trying to do is give the user/coder the option to show/utilize the char count feature.  Can make it disappear with textarea1.CharacterCountVisible = False but setting it to true will not make it display.


What am i missing





SQL Server Express2008 R2 brings app down, instance problem


I have tried dozens of changes and modifications to many settings as I will outilne here and all to no avail.

The short answer here though is that I uninstalled SQL Sever Express 2008 R2 and went back to the "NON" 2008 R2 and got things working. But like the fool I am wanted to run on the more current rev and updated again, all problems returned....



Win Server 2003 R2 SP2


VWD2008 Express (removed)




XP Sp3

VWD2008 Express

SQL Server Express 2008


I was orginally getting this message after updating to SQL Sever Express 2008 R2, I removed VWD 2008 Express from the web server, no good, then uninstalled SQL Server 2008 Express R2 and reinstalled SQL Server 2008 Express. worked but had issues, couldn't install MGTM Studio. Then I removed SQL 2008, cleaned folders and reg. Reloaded SQL Server 2008 Express, still flaky, couldn't get the Management Studio to install. So I removed it again and used the Web Platform Installer, which worked but loaded 2008 R2 again. Which brought back the message.

Failed to genera

Session problem with display of image in row of reportviewer


Hello techies...

I am new to this sql reporting service. But anyhow by surfing I am able to bind the report but i was stuck in image display.

Anyways, i also managed that. But the real problem is whenever i was keeping a image control in rdlc report i was having session prob. If i remove the image control then as usual report works fine.

Please suggest me some solution.... either for session problem or for image display. I am keeping the image name in database but for binding the rdlc report i am using a store procedure which return the path (static) concating with the image name(kept in database).

Hope to find a solution .....

Extreme ASP.NET: A New Solution to an Old State Storage Problem


State management in Web applications is a contentious issue. Should you store user data per session or should you persist it across sessions? You can easily store information temporarily while someone navigates your site by using session state.

Fritz Onion

MSDN Magazine April 2006

Best Practices: Fast, Scalable, and Secure Session State Management for Your Web Applications


ASP.NET provides a number of ways to maintain user state, the most powerful of which is session state. This article takes an in-depth look at designing and deploying high-performance, scalable, secure session solutions, and presents best practices for both existing and new ASP.NET session state features straight from the ASP.NET feature team.

Mike Volodarsky

MSDN Magazine September 2005

Taming the Stateless Beast: Managing Session State Across Servers on a Web Farm


Running a Web farm means managing session state across servers. Since session state can't be shared across a Web farm with Internet Information Services 5.0, a custom solution is required. One such solution using a tool called the session manager is described here. The article begins with a description of the SQL Server database used to store state information, the stored procedures used to update it, and the retrieval of session data. ASP code drives the session manager tool and the COM and COM+ components that run the stored procedures.

John Papa

MSDN Magazine October 2000

Problem with Session and PageMethod


Hi All,

I'm trying to show some data in the update panel refreshing every second using page method. Everything works fine until I introduce Session. As soon as I save some data into the session my Ajax Page method is not called every second. Here is the complete code


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript" language="JavaScript">
        function UpdateStatus() {
            setTimeout("UpdateStatus()", 1000);

        function ShowStatus(sCurrentStatus) {
            document.getElementById('lblStatus').innerHTML = sCurrentStatus;
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True&q
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend