Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
error loading XSLT with msxsl:script vb embedded
Messages   Related Types
This message was discovered on microsoft.public.dotnet.xml.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Russ Holmes
My vb.net code attempts top load an XSL file into an XSLTransform instance;

'----------------------------------------------
Dim oXMLDoc As New Xml.XmlDocument

Dim oXslTransform As New Xml.Xsl.XslTransform

Dim stWrite As New System.IO.StringWriter

'load xml string into XMLDocument

oXMLDoc.LoadXml(strXML)

'load xsl file into XSLTransform, passing in uri

oXslTransform.Load(strLocation) '------------------error raised here

'transform into stringwriter

oXslTransform.Transform(oXMLDoc, Nothing, stWrite, Nothing)

'----------------------------------------------

This works fine if the XSL that I use doesn't contain any embedded VB..eg;

----------------------------------------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"
xmlns:myscript="myVB">

<xsl:template match="/">
NOT USING SCRIPT
</xsl:template>

</xsl:stylesheet>

----------------------------------------------

However if I use script which does include vb...eg;

----------------------------------------------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"
xmlns:myscript="myVB">

<msxsl:script language="vb" implements-prefix="myscript">
Function wv_test()
wv_test="USING SCRIPT"
End Function
</msxsl:script>

<xsl:template match="/">

<xsl:value-of select="myscript:wv_test()"/>

</xsl:template>

</xsl:stylesheet>

----------------------------------------------

.....I get the following error;

Access to the path "C:\DOCUME~1\BRUCE\ASPNET\LOCALS~1\Temp\rsdw42up.0.vb" is
denied. Call Stack: GlobalDisplay.XMLData:Transform_XML

The name of the file changes each time I attempt to view the page, so next
time I try it I get;

C:\DOCUME~1\BRUCE\ASPNET\LOCALS~1\Temp\kbhxdxel.0.vb

BRUCE is the name of my machine. It also errors if I remove the xsl line
that calls the vb function (<xsl:value-of select="myscript:wv_test()"/>)
...so it seems like it its trying to compile the vb (to the temp file?) but
does not have access.. I tried adding the ASPNET user to the administrators
group which has full control over that directory with no success..

Any help greatly appreciated

Russ

Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Oleg Tkachenko [MVP] (VIP)
Russ Holmes wrote:

[Original message clipped]

Yeah, that's how it works - msxsl:script content is compiled into a
temporary assembly, which is then called. That definitely sounds like
security issue.

I tried adding the ASPNET user to the administrators
> group which has full control over that directory with no success..
So it happens in ASP.NET?

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.IO.StringWriter
System.Web.UI.WebControls.Xml
System.Xml.XmlDocument
System.Xml.Xsl.XslTransform




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734