• Авторизация


Access to SqlServer from SharePoint WebParts 06-10-2004 18:48 к комментариям - к полной версии - понравилось!


If you are developing custom web parts that need to connect to a SQL Server database to retrieve data, you may be confronted with the following error:

{"Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed." }

This is due to SharePoint Portal Server and Windows SharePoint Services implementation of .NET Code Access Security (CAS). A solution that addresses the aforementioned error is cited below:

Locate and open the wss_minimaltrust.config file (NOTE: If you've gone with the default SharePoint or WSS install, this file is located at :Program FilesCommon FilesMicrosoft SharedServer Extensions60Config)

Add the following element to the SecurityClasses section of this config file:

<securityclass name="SqlClientPermission" description="System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"></securityclass>
In the PermissionSet section of this configuration file, add the following:
<ipermission class="SqlClientPermission" version="1" unrestricted="true"></ipermission>

If you still run into the error, try adding these settings to the wss_mediumtrust.config file.
Ну а еще проще - пишите в web.config "Full" вместо Mimimal или Medium. Можно, конечно, и в GAC WebPart внести, но только когда отладка закончена. :)
вверх^ к полной версии понравилось! в evernote


Вы сейчас не можете прокомментировать это сообщение.

Дневник Access to SqlServer from SharePoint WebParts | Oleg_Kleiman - Soft kibitzing | Лента друзей Oleg_Kleiman / Полная версия Добавить в друзья Страницы: раньше»