Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Security Exception in a custom web part

  Asked By: Lavanya Mulani         Date: Nov 29, 2009      Category: Sharepoint      Views: 236
 

I'm developping with Microsoft Visual Studio .Net a SPS 2003 web part. This
web part failed when trying to connect to an external SQL server.

Just by executing this line it fails:
OleDbConnection myConnection = new OleDbConnection("Provider=SqlOleDb; Data
Source=SERVER1; Initial Catalog=dbName; User Id=appDBName; Password=mypass;
Connect Timeout=130");

The error message in a .Net format (with light yellow parts):
The application attempted to perform an operation not allowed by the
security policy. To grant this application the required permission please
contact your system administrator or change the application's trust level in
the configuration file

Does anyone can help me? What security policy is blocking my connection and
where I can change it?

I would say that the IIS login is the problem but I don't know where to
change it exactly

Tagged:            

 

2 Answers Found

 
Answer #1       Answered By: Ramona Solis          Answered On: Nov 29, 2009       

This is a result of security  settings are the IIS level. Search MSDN for "Code
Access Security" for info on how this works.

 
Answer #2       Answered By: Harvey Blankenship          Answered On: Nov 29, 2009       

Change the trust level in Web.Config from WSS_Minimal to WSS_Medium...

 
Didn't find what you were looking for? Find more on Security Exception in a custom web part Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].