Application crashes using XslCompiledTransform.Transform method while running from network.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
HI,
We have an application that runs from network path. For some strange reason application crashes when we perform XSL transformation.<br/>
Details:<br/>
Application Framework: 2.0<br/>
Application Server: Windows 2008 R2 Datacenter<br/>
Caspol executed:<br/>
C:WINDOWSMicrosoft.NETFramework64v2.0.50727caspol.exe -pp off -m -ag LocalIntranet_Zone -url "\NetworkShare*" FullTrust -n AppNETGroup<br/>
C:WINDOWSMicrosoft.NETFramework64v2.0.50727caspol.exe -pp off -m -ag Internet_Zone -url "\NetworkShare*" FullTrust -n AppNETGroup
Please find the sample code:

<pre class="prettyprint public static XmlDocument TransformXML(XPathDocument _xslTemplate, XmlDocument _xmlSource, XsltArgumentList xslArgs)<br/> {
XslCompiledTransform myXslTrans = new XslCompiledTransform();

if (_xmlSource.FirstChild.NodeType != XmlNodeType.XmlDeclaration)
{
XmlDeclaration xmldecl = _xmlSource.CreateXmlDeclaration("1.0", "ISO-8859-1", "yes");
XmlElement root = _xmlSource.DocumentElement;
_xmlSource.InsertBefore(xmldecl, root);
}

// Load the XSLT template
myXslTrans.Load(_xslTemplate);

StringBuilder strBuilder = new StringBuilder();
XmlWriter xmlWriter = XmlWriter.Create(strBuilder);

// Transform the source using the xslTransformer
myXslTrans.Transform(_xmlSource, xslArgs, xmlWriter);
XmlDocument oXmlDocument = new XmlDocument();
oXmlDocument.LoadXml(strBuilder.ToString());

return oXmlDocument;


} [/code]
Please note that I also tried to transform XSL(hosted over the network) using VisualStudio 2010, I got following errors<br/>
SecurityException<br/>
-----------------<br/>
Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.<br/>
<br/>
XSL generated a security exception. If you trust this stylesheet then copying it to your local hard drive will remove this security check. But it is highly advised that you review all script blocks and HTTP requests in the stylesheet before you do so.<br/>
<br/>
FirstPermissionThatFailed<br/>
<br/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Flags="ControlEvidence, ControlPolicy"/><br/>
<br/>
<br/>
Demanded<br/>
<br/>
<PermissionSet class="System.Security.PermissionSet"<br/>
version="1 <br/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Flags="ControlEvidence, ControlPolicy"/><br/>
</PermissionSet><br/>
<br/>
<br/>
GrantedSet<br/>
<br/>
<PermissionSet class="System.Security.NamedPermissionSet"<br/>
version="1"<br/>
Name="LocalIntranet"<br/>
Description="Default rights given to applications on the local intranet <br/>
<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Read="USERNAME"/><br/>
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Unrestricted="true"/><br/>
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Read="\machineUsers"/><br/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Allowed="AssemblyIsolationByUser"<br/>
UserQuota="9223372036854775807"<br/>
Expiry="9223372036854775807"<br/>
Permanent="True"/><br/>
<IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Flags="ReflectionEmit, RestrictedMemberAccess"/><br/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Flags="Assertion, Execution, BindingRedirects"/><br/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Unrestricted="true"/><br/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"<br/>
version="1"<br/>
Level="DefaultPrinting"/><br/>
<IPermission class="System.Net.DnsPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Unrestricted="true"/><br/>
<IPermission class="System.Security.Permissions.TypeDescriptorPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"<br/>
version="1"<br/>
Unrestricted="true"/><br/>
<IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"<br/>
version="1"<br/>
Audio="SafeAudio"<br/>
Video="SafeVideo"<br/>
Image="SafeImage"/><br/>
<IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"<br/>
version="1"<br/>
Level="Safe"/><br/>
</PermissionSet>
Kind Regards. <hr class="sig Yet to be discovered!

View the full article
 
Back
Top