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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Anthony PerkinsConnect With a Mentor Commented:
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
 
Anthony PerkinsCommented:
That means that the ASP user does not have GRANT SELECT permissions on the table.
0
 
Alan WarrenConnect With a Mentor Commented:
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
All Courses

From novice to tech pro — start learning today.