Hello, I am having an issue in using an embedded xslt in a dll when a part of that xslt is calling an extension object which uses an external resource. My xslt code is as follows
< xsl:stylesheet version="1.0" xmlns:xsl=" http://www.hide-link.com/ ;
xmlns :mapUtil="urn:mapUtil" extension-element-prefixes="mapUtil">
<!-- some other xslt stuff but below is the main part -->
< xsl:variable name="primaryIndex" select="mapUtil:GetCategoryInformation($Id, 'PrimaryIndex', 'true')"/>
The GetCategoryInformation method inside the MappingUtility object calls a stored procedure. When I try to run this through, I get a
"Request for the permission of type System.Data.SqlClient.SqlClientPermission ... " error.
I am embedding the xslt into the dll at compile time as follows. Reason that we are embedding the xslt are for security reasons and ease of deployment. If I load the xslt at runtime using the commented out code, it works though..
Any help would be appreciated.... Thanks
XmlUrlResolver_resolver = new XmlUrlResolver();
System.Security.Policy.Evidence _evidence = new System.Security.Policy.Evidence();
XsltArgumentList _argsList = new XsltArgumentList();
MappingUtility util = new MappingUtility();
_argsList.AddExtensionObject("urn:mapUtil", util);
// This works but does not embed the xslt at compile time
// _transFund = new XslTransform();
// _transFund.Load(xsltFund, _resolver);
// Embed the xslt but it does not work for some security permission reasons
string xsltFund = "SolutionXmlPackage.Mapping21.xslt.Fund.xslt";
_transFund = new XslTransform();
_transFund.Load( new XmlTextReader(
GetType().Assembly.GetManifestResourceStream(xsltFund)),
_resolver, _evidence);
.NET Development30
|