G
Greg Collins [MVP]
I have an ASP.NET page that uses a tag:
<asp:Xml id="foo" runat="server" DocumentSource="rss.xml" TransformSource="rss20.xsl" />
This creates a Web page from an XML file that was generated by InfoPath. By default InfoPath inline's their images in base64 encoding. These need to be extracted out to be displayed.
I've got my XSL set up to be able to pull out images and manage them separately. According to Microsoft, they need to be decoded and returned back as an image stream to the src attribute of the img tag.
See: http://www.mcse.ms/archive180-2004-4-605843.html
See: http://blogs.msdn.com/infopath/archive/2004/04/21/117600.aspx
So I've got some C# code in my XSL that performs this decode operation -- well, that's where I need help. Here's the code:
<msxsl:script language="C#" implements-prefix="cs">
<![CDATA[
Image decode(string s)
{
byte[] image = Convert.FromBase64String( s );
System.IO.MemoryStream memStr = new System.IO.MemoryStream();
memStr.Write( image, 0, image.Length );
System.Drawing.Image img = System.Drawing.Image.FromStream(memStr);
return image;
}
]]>
</msxsl:script>
The problem I'm hitting is that the process is failing on System.Drawing.Image -- it doesn't know what it is. Here's what I get back:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Script compile errors: file:///c:/inetpub/wwwroot/rss20.xsl(8,1) : error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.Xsl.XsltException: Script compile errors: file:///c:/inetpub/wwwroot/rss20.xsl(8,1) : error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
<<<<<<<<<<<<<<
So my question is how do I add an assembly reference to System.Drawing, and where? This is an ASP.NET page with an XML/XSL transform. I don't have a whole lot of .NET knowledge -- I only JUST discovered I can actually even use C# in XSL (I just tried it out of pure curiosity -- and that gave me some hope!)
Anyone know how to add this assembly reference and where? Thanx!
<asp:Xml id="foo" runat="server" DocumentSource="rss.xml" TransformSource="rss20.xsl" />
This creates a Web page from an XML file that was generated by InfoPath. By default InfoPath inline's their images in base64 encoding. These need to be extracted out to be displayed.
I've got my XSL set up to be able to pull out images and manage them separately. According to Microsoft, they need to be decoded and returned back as an image stream to the src attribute of the img tag.
See: http://www.mcse.ms/archive180-2004-4-605843.html
See: http://blogs.msdn.com/infopath/archive/2004/04/21/117600.aspx
So I've got some C# code in my XSL that performs this decode operation -- well, that's where I need help. Here's the code:
<msxsl:script language="C#" implements-prefix="cs">
<![CDATA[
Image decode(string s)
{
byte[] image = Convert.FromBase64String( s );
System.IO.MemoryStream memStr = new System.IO.MemoryStream();
memStr.Write( image, 0, image.Length );
System.Drawing.Image img = System.Drawing.Image.FromStream(memStr);
return image;
}
]]>
</msxsl:script>
The problem I'm hitting is that the process is failing on System.Drawing.Image -- it doesn't know what it is. Here's what I get back:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Script compile errors: file:///c:/inetpub/wwwroot/rss20.xsl(8,1) : error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.Xsl.XsltException: Script compile errors: file:///c:/inetpub/wwwroot/rss20.xsl(8,1) : error CS0246: The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
<<<<<<<<<<<<<<
So my question is how do I add an assembly reference to System.Drawing, and where? This is an ASP.NET page with an XML/XSL transform. I don't have a whole lot of .NET knowledge -- I only JUST discovered I can actually even use C# in XSL (I just tried it out of pure curiosity -- and that gave me some hope!)
Anyone know how to add this assembly reference and where? Thanx!