title: What account to use in sessionstate connectionstring
body: <p>I am working on a Website that was donated to our institution, right now I'm trying to decide exactly how to set up two connection strings (CS) in the Web.config file (some of the details in these connection strings were redacted by the donator). 
  The CS I have a question about is referenced in sessionState:</p>
  
  <pre><code>&lt;sessionState allowCustomSqlDatabase="true" mode="SQLServer" sqlConnectionString="DevelopmentSessionState" cookieless="false" timeout="20"/&gt;
  </code></pre>
  
  <p>I'm trying to determine what type of Account I should be using for the UserID in the SessionState CS. In order to get the Website functional I used the sa account, but I know this isn't a good idea - I'm looking for an account to replace sa. I have no idea if this is a user I should define in SQL Server, or if I should use a pre-existing account, or what type of access this user should have. </p>
  
  <p>I am also fuzzy on the idea of why a separate connection string is needed for Session State. The Website's c# code uses the other CS explicitly to connect to the db, but the only reference to the SessionState CS is in Web.config. I have read a lot about Session State and SQLServer mode that past few days, but I haven't found any recommendations for what account to use or why a separate CS is needed for SessionState.</p>
  
  <p>Thanks,
  Chris</p>
  
  <p>Update: This is the stack trace from the abend that happens when I substitute my UserID for sa in the Session State CS (I replaced my actual User ID with USERID):</p>
  
  <pre><code>Server Error in '/' Application.
  
  Failed to login to session state SQL server for user 'USERID'. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
  Exception Details: System.Web.HttpException: Failed to login to session state SQL server for user 'USERID'.
  
  Source Error: 
  
  
  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
  
  Stack Trace: 
  
  
  
  [SqlException (0x80131904): Login failed for user 'USERID'.]
  System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4876535
  System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
  System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1121
  System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
  System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
  System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +367
  System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +225
  System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
  System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185
  System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
  System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +431
  System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
  System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
  System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
  System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
  System.Data.SqlClient.SqlConnection.Open() +122
  System.Web.SessionState.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo) +93
  
  [HttpException (0x80004005): Failed to login to session state SQL server for user 'USERID'.]
  
  
  
  
  Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491  
  </code></pre>