Major problems with Microsoft SQL Server and Permissions!

I am trying to set up SQL state for ASP.NET on a Windows 2003 server with MS SQL server 2005. I am getting this error:

Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

1) I have created the ASPSstate database using the prefered Microsoft Methods.
2) This is my connection string in the web.config:
              <sessionState
                            mode="SQLServer"
                              sqlConnectionString="Server=MyServer;Database=ASPState;Integrated ecurity=SSPI;Trusted_Connection=Yes"
                              allowCustomSqlDatabase="true"
                              cookieless="false"
                               />
3) Then just to get this puppy working I ran this query to give the permission to NT AUTHORITY\NETWORK SERVICE, which is what i thought sql wanted.

use aspstate

sp_changedbowner 'NT AUTHORITY\NETWORK SERVICE',true

4) I then go this error "SELECT permission denied on object 'ASPStateTempApplications'" which I reseached and found that this is the fix (beause of SQL and SP3 apparently you have to jump through this hoop)

use master
go
EXEC sp_configure 'Cross DB Ownership Chaining', '0'; RECONFIGURE
go

use master
go
EXEC sp_dboption 'ASPState' , 'db chaining', 'true'
go

5) OK restarted SQL server and this didn't work at all. I also tried assigned permissions to SA but sql didnt like that and wouldn't let me login.

The goal here is to use SSI or integrated security so i dont have to have the SA password in the web.config. PLEASE HELP ME BEFORE I TURN A SHOTGUN ON MYSELF!!

- jenni
LVL 3
JenniQAsked:
Who is Participating?
 
Computer101Connect With a Mentor Commented:
PAQed with points refunded (350)

Computer101
EE Admin
0
 
JenniQAuthor Commented:
HEre is  a little more detailed error message:

SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
INSERT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
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.Data.SqlClient.SqlException: SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
INSERT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.

Thank you thank you thank you!
0
 
hclgroupCommented:
Why don't you just create the user and assign permissions through Enterprise Manager?
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
JenniQAuthor Commented:
I tried... obviously i dont know what Im doing. Can you give me a little more info ?
0
 
AaronAbendCommented:
go to start-> programs-> Microsoft SQL 2005 -> SQL Server Management Studio. You should be able to connect to your database there. Check the security tab for your login, and check the databases tab and your databaes (ASPState) to make sure that user is listed as having permission, and right mouse to see the permissions granted on each table. tho DBO should give you everything you need.

I am not an ASP guy - not sure what else could cause the problem
0
 
JenniQAuthor Commented:
Thank you so much for your post!!

OK so I log into SQL 2005 Managment Studio. Under the SERVERNAME / SECURITY / LOGINS tree node I see the account SA. I double clikc on SA and then choose the User Mapping tab to see some databases that have been checked. I put a check next to ASPState and click ok and I get the message:

Create failed for User 'sa'.  (Microsoft.SqlServer.Smo)
Cannot use the special principal 'sa'. (Microsoft SQL Server, Error: 15405)

I look at the NETWORK SERVICE user, which is what ASPState is complaining about, and it is already mapped to that ASPState Database. (ASPState has DBO as the User on this page)

Next, I go to the ASPState database then go to security/users. I see DBO in this node. THere are two sections; Owned Schemas and Database Role Memebeship.

For Owned Scheam everythign is grey checked (you konw when the box is gray but there is acheck.) this includes a lot of stuff like db_denydataReader etc which I can't uncheck...

Under Database rol memebership the db_owner is checked.

The ASPState database has no tables.

THANK YOU SO MUCH in advance for your help! this problem is really killing me....

Thakn you thank you thank you!

-- Jenni




0
 
JenniQAuthor Commented:
Anyone? :(
0
 
JenniQAuthor Commented:
still looking for help!
0
 
AaronAbendCommented:
Jenni I don't have the asp expertise to help.  Let's do this. I will post another question as a pointer to this one. Sometimes when questions get old and experts see another expert helping, they go on to help other people and a question gets stale before it gets answered. In this case, it may be that not a lot of SQL guys have ASP as well.  Since your question did not emphasize that, I will repost with an emphasis on that aspect of the issue.

Let's see if we can get you the help you need.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>Cannot open database "ASPState" requested by the login. The login failed.
>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

this means that the login can connect to the sql server, but not to the database.
reason: the login has not been mapped to a user in the database, ie no permissions are granted to the login in that database, hence, the error you see.

solution:
 open the properties of the login, and go to the tab to grant access to the database ASPState.


0
 
AaronAbendCommented:
By the way, you will see that I asked the question by simply posting your error message "Cannot open database "ASPState" requested by the login"

Your question "major problem with permissions" suggests that the problem has to do with permissions. It is best not to assume the nature of a problem. Just post the error you are getting, since an expert who recognizes that message can help you immediately, whereas "major problem with permissions" does not necessarily help an expert determine whether a question is within their expertise.  
0
 
imran_fastCommented:
hi JenniQ,
First check what is the user in IIS security tab.
Second check that whether or not that user have access in sql server on the specific database

Regards

Imran
0
 
AaronAbendCommented:
JenniQ,

Imran has posted some info for you... If there is no additional post by Monday 11/20 I will be closing my pointer questions. Please either close the question and ask for a refund (and maybe repost in the asp area) or follow up with Imran.

Thanks
0
 
JenniQAuthor Commented:
Hey Guys,

Thanks for your response. Please let me look this question over tonight and see if I can solve it based off these answers, then I will decied if I wanna close it or open a new Q.

Thanks guys!

-- JenniQ
0
 
JenniQAuthor Commented:
Aaron. Thank you for your help posting a pointer to this question! I will take your advice when posting in the future.

Imran -- the ASPSTATE database has no  IIS website associated with it.

I followed tried giving the login user full dbo permissions and am recieve this error now:

SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
SELECT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.
INSERT permission denied on object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.

I'm just going to try to uninstalling ASPSTATE from this server and re installing. I have a feeling something is wrong wit the installation.

Thank you for your help again!!

0
 
JenniQAuthor Commented:
I never received an answer - I gave up on this problem.....
0
 
bruceshiningCommented:
There is no "Accepted Solution", but I saw a great response by Angelll (ranked Genius) that helped me.
I have copied it here:

>Cannot open database "ASPState" requested by the login. The login failed.
>Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

this means that the login can connect to the sql server, but not to the database.
reason: the login has not been mapped to a user in the database, ie no permissions are granted to the login in that database, hence, the error you see.

solution:
 open the properties of the login, and go to the tab to grant access to the database ASPState.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.