Security Exception while using Excel COM object in web part
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Security Exception while using Excel COM object in web part

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
rahul
Guest





Posted: Mon Jan 17, 2005 6:15 pm    Post subject: Security Exception while using Excel COM object in web part Reply with quote

hi
i have this situation where i am usign an Excel COM object in the 'render'
of a web part. the same code works fine in a normal asp.NET application.
however i get a security exception when i use it ina web part.
kindly help me in resolving this issue

thanks
rahul
Back to top
DJA
Guest





Posted: Tue Jan 18, 2005 8:46 am    Post subject: Re: Security Exception while using Excel COM object in web p Reply with quote

Your webpart must have the correct Code Access Permissions. For this to
work the webpart requires at least the permission to call unmanaged
code. This is configured in the trust configuration file. If your
webpart is placed in the bin directory of the website, it will not have
this right as a default. Also note that when your webpart is in the bin
directory it is not granted full trust. If you call another assembly
like an Interop-assembly, the Interop-assembly must have the attribute
[assembly: AllowPartiallyTrustedCallers] set (remember the using
System.Security declaration) in the assemblyinfo file. This is because
your webpart is not fully trusted.

If you do not care about giving your webpart full trust. Your problems
would probably be solved by placing your webpart assembly in the GAC.
Remember to do an IISRESET after each deployment in GAC.

Find more information about Code Access Security in SPS here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/smpscCodeAccessSecurityDevs.asp
Regards,
Dan
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB