Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SecurityException when using XSLTArgumentList in webpart

  Asked By: Nicholas    Date: Nov 14    Category: Sharepoint    Views: 788

I am facing a problem in my webpart development.
I am using the XML web control in my webpart to perform
XSLT transformation. But in my xslt i am calling user defined functions
written in c#. for this i use XSLTArgumentList class and add it using
AddExtensionObject.

It is documented that the caller needs to have "FullTrust" to invoke the
AddExtensionObject method. if not a SecurityException occurs.

Though I am deploying my webpart in Gac i am getting this error.
So I modified my wss_minimaltrust.config file and added an IPermission tag with Strongname membership condition for my webpart assembly still same result.

The funny thing is it works fine when i use the same logic in a web application. but when i use it in a webpart it does not.

anyone can throw some light on this.

HOW to grant FULLTRUST privilege to a custom webpart assembly??

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Nina Banks     Answered On: Nov 14

I'm not positive here, but I believe the limitations
listed here
weblogs.asp.net/.../389371.aspx
are getting in the way of what you are attempting to
do as well.

So I don't think anything you do will help, you'll
need to figure out a different way to solve the
problem.

However, I'm all ears if someone has a solution.

 
Answer #2    Answered By: Sharonda Mcfarland     Answered On: Nov 14

I am able to get the webpart  to work if i set trust level="full" in the web.config. Therefore if I manage to give full trust to the webpart assembly  I should be able to get the webpart to work with XSLTArgumentList.
modified  the wss_mediumtrust.config file  as listed below but the webpart assembly is not fully trusted. Can anyone of you please take a look at this and point out the mistake.

Apparently, like all parents, I am blind to the faults of my child. ;-))

<NamedPermissionSets>
<PermissionSet
 class  ="NamedPermissionSet"
version ="1"
Unrestricted ="true"
Name ="FullTrust"
Description ="Allows full access to all resources"
/>
<!-- remaining permission set definitions -->

</ NamedPermissionSets >

< CodeGroup
class="FirstMatchCodeGroup"
version ="1"
PermissionSetName ="Nothing">
<IMembershipCondition
class="AllMembershipCondition"
version="1"
/>
< CodeGroup
class ="UnionCodeGroup"
version ="1"
PermissionSetName ="FullTrust">
< IMembershipCondition
class ="StrongNameMembershipCondition"
version ="1"
PublicKeyBlob ="0024.......4806BE02D13FB854DDA"
Name ="<Webpart Assembly name>"
AssemblyVersion =" 1.0.0.0"/>
< IMembershipCondition
class ="UrlMembershipCondition"
version ="1"
Url ="$AppDirUrl$/*"/>
</CodeGroup>
< CodeGroup
class ="UnionCodeGroup"
version ="1"
PermissionSetName ="ASP.Net">
< IMembershipCondition
class ="UrlMembershipCondition"
version="1"
Url ="$AppDirUrl$/*"/>
</ CodeGroup >

<!-- remaining code group definitions -->
</ CodeGroup >

 
Answer #3    Answered By: Kalyan Pujari     Answered On: Nov 14

Why are you mandating that your assembly  be identified both by its
public key blob and UrlMembershipCondition of $AppDirUrl. I typically
only use the StrongNameMembershipCondition.

 
Didn't find what you were looking for? Find more on SecurityException when using XSLTArgumentList in webpart Or get search suggestion and latest updates.