Ado.Net ExecuteReader with a read-only SQL Server user
At the Application_Start of my web site I execute a stored procedure to read some data from one SQL Server 2008 database.
This is the only call to this database.
I would create a specific SQL Server user开发者_StackOverflow, with read-only permission, to exec this sp.
I created a new SQL Server user with db_datareader role, but when I exec the sp I have an error at this line:
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
The error is: EXECUTE permission denied on object
...
How can I workaround this ?
Thanks
Have you granted the user you created access to the stored procedure?
GRANT EXECUTE ON sp_your_proc TO your_user;
精彩评论