MSSQL ASP.net error permission error

The SELECT permission was denied on the object '....', database '.....', 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: The SELECT permission was denied on the object '.....', database '.......', schema 'dbo'.
shpresaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anthony PerkinsCommented:
That means that the ASP user does not have GRANT SELECT permissions on the table.
0
Anthony PerkinsCommented:
Word of caution and although this may sound counter intuitive, but doing a GRANT SELECT ON TableName TO ASPUser, may actually not be the best solution.  You are better off including it in a Stored Procedure and doing a GRANT EXECUTE ON StoredProcedureName TO ASPUser.  That is of course if the SELECT is not already in a Stored Procedure and not using Dynamic SQL.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alan WarrenApplications DeveloperCommented:
Hi shpresa,

Can you log into your the SQL server using SQL Server Management Studio, providing the same credentials as defined in in your web.config connectionstrings?

If so, can you then execute your 'Select' script from within SQl Server Management Studio?

If not, you need to grant some permissions to the user account. To do so, you may need to logout of SQL Server Management Studio and login again using an Admin account, usually named sa, grant the necessary permissions, then logout as 'sa' and log in again using the account credentials defined in your web.config and test that you can now execute your SQL script. After which it should work from your asp .net application too.


Alan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.