0

I have developed a web part and trying to access the SQL Server 2008 from the button click Event in the web part and I get the following error.

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

I have tried this post but not helped me. I want to find out what is cause for this error.

This Post

1 Answer 1

1

If you are using Windows authentication on SQL server most likely you have double-hop issue:

Sharepoint Single Sign-On, Impersonation and the Double-Hop Problem

Simplified: user credentials are 'lost' when you reach SQL server and SQL denies your request.

Simplest solution for this is to put your SQL server in mixed mode and use SQL Server Authentication to allow access from your webpart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.