SQL Session State

A

Ahmed Hashish

Dear All
I'm trying to use the sql server 2005 to store my web application session variables,
First I modified the web.config as follows:
<sessionState mode="SQLServer"

cookieless="true"

regenerateExpiredSessionId="true"

timeout="60"

sqlConnectionString="Data Source=ServerName\InstanceName;user Id=myuser;pwd=mypwd"

stateNetworkTimeout="60"/>

Second:

I installed the file Windows\Microsoft.Net\Framework\v2.0.50727\InstallSqlState.sql

Third:

The problem that when I tried to run my application an error:

"Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'MyUser'"

What Permissions I need to add to that user to allow login to the database?
 
W

Winista

You need to create a user account "MyUser" in SQL server. And make sure that your SQL Server is set for mixed mode authentication.


--
Netomatix
http://www.netomatix.com
Dear All
I'm trying to use the sql server 2005 to store my web application session variables,
First I modified the web.config as follows:
<sessionState mode="SQLServer"

cookieless="true"

regenerateExpiredSessionId="true"

timeout="60"

sqlConnectionString="Data Source=ServerName\InstanceName;user Id=myuser;pwd=mypwd"

stateNetworkTimeout="60"/>

Second:

I installed the file Windows\Microsoft.Net\Framework\v2.0.50727\InstallSqlState.sql

Third:

The problem that when I tried to run my application an error:

"Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'MyUser'"

What Permissions I need to add to that user to allow login to the database?
 
A

Ahmed Hashish

I already done this but it gives another error "
Unable to use SQL Server because ASP.NET version 2.0 Session State is not installed on the SQL server. Please install ASP.NET Session State SQL Server version 2.0 or above. "

You need to create a user account "MyUser" in SQL server. And make sure that your SQL Server is set for mixed mode authentication.


--
Netomatix
http://www.netomatix.com
Dear All
I'm trying to use the sql server 2005 to store my web application session variables,
First I modified the web.config as follows:
<sessionState mode="SQLServer"

cookieless="true"

regenerateExpiredSessionId="true"

timeout="60"

sqlConnectionString="Data Source=ServerName\InstanceName;user Id=myuser;pwd=mypwd"

stateNetworkTimeout="60"/>

Second:

I installed the file Windows\Microsoft.Net\Framework\v2.0.50727\InstallSqlState.sql

Third:

The problem that when I tried to run my application an error:

"Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'MyUser'"

What Permissions I need to add to that user to allow login to the database?
 
Joined
Jul 31, 2006
Messages
2
Reaction score
0
Permissions

I got that same error because I had failed to set the proper permissions, like so:

USE ServerName

GO
EXECUTE sp_grantdbaccess myuser
GO
GRANT EXECUTE on CreateTempTables to myuser
GRANT EXECUTE on DeleteExpiredSessions to myuser
GRANT EXECUTE on GetHashCode to myuser
GRANT EXECUTE on GetMajorVersion to myuser
GRANT EXECUTE on TempInsertUninitializedItem to myuser
GRANT EXECUTE on TempGetAppId to myuser
GRANT EXECUTE on TempInsertStateItemShort to myuser
GRANT EXECUTE on TempGetStateItem to myuser
GRANT EXECUTE on TempGetStateItem2 to myuser
GRANT EXECUTE on TempGetStateItem3 to myuser
GRANT EXECUTE on TempGetStateItemExclusive to myuser
GRANT EXECUTE on TempGetStateItemExclusive2 to myuser
GRANT EXECUTE on TempGetStateItemExclusive3 to myuser
GRANT EXECUTE on TempGetVersion to myuser
GRANT EXECUTE on TempInsertStateItemLong to myuser
GRANT EXECUTE on TempReleaseStateItemExclusive to myuser
GRANT EXECUTE on TempRemoveStateItem to myuser
GRANT EXECUTE on TempResetTimeout to myuser
GRANT EXECUTE on TempUpdateStateItemLong to myuser
GRANT EXECUTE on TempUpdateStateItemLongNullShort to myuser
GRANT EXECUTE on TempUpdateStateItemShort to myuser
GRANT EXECUTE on TempUpdateStateItemShortNullLong to myuser
GO

GRANT SELECT on ASPStateTempApplications to myuser
GRANT INSERT on ASPStateTempApplications to myuser
GRANT SELECT on ASPStateTempSessions to myuser
GRANT INSERT on ASPStateTempSessions to myuser
GRANT UPDATE on ASPStateTempSessions to myuser

GO
 
Joined
Jul 31, 2006
Messages
2
Reaction score
0
Creating SQL Server Session State

Also, don't use the old scripts from SQL Server 2000 to create the Session State Database. They won't work for ASP.NET 2.0. Use aspnet_regsql.exe instead, like so:

aspnet_regsql -C "Data Source=INCFITSYSDB01;Integrated Security=True" -ssadd -sstype c -d MySessionDB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top