Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SecurityException when using XSLTArgumentList in webpart

  Asked By: Demarco    Date: Nov 11    Category: Sharepoint    Views: 1282

I am facing a problem in my webpart development.
I am using the XML web control in my webpart to
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

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

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

anyone can throw some light on this.

HOW to grant FULLTRUST privilege to a custom webpart



3 Answers Found

Answer #1    Answered By: Renee Murray     Answered On: Nov 11

I'm not positive here, but I believe the limitations
listed here
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

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

Answer #2    Answered By: Harshini Raju     Answered On: Nov 11

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.

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

</ NamedPermissionSets >

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

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

Answer #3    Answered By: Christop Mcfadden     Answered On: Nov 11

I solved the problem  by adding the function i wrote in a C# file  to a msxsl:script tag in the xslt  file. this eliminated the need to use AddExtensionObject and thereby the need to give full trust to the webpart.

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