System.Xml.XmlException: Resolving of external URIs was prohibited.
An unhandled exception was generated during the execution...
For several days I've been trying to resolve the above error.
This documentation claims that the above error can be mitigated by using XmlResolver, XmlSecureResolver, XmlUrlResolver or some combination of the three. Note that I have been able to reproduce this error with a single xsl:import element (no document() functions involved, so XmlSecureResolver is NOT an issue nor needed, as far as I can tell).
xsl:import or xsl:include functions
The following code produces the above error:
Dim xsl_src As String = Server.MapPath("stylesheets\\main.xsl")
Dim xml_src As String = Server.MapPath("data\\mydata.xsl")
Dim xslt As New XslCompiledTransform
Dim xslt_settings As New XsltSettings
Dim resolver As New XmlUrlResolver
xslt.Load(xsl_src, xslt_settings, resolver)
According to all the articles I've been able to find on this topic and according to what I've been able to glean from the MS documentation, this should work, but it doesn't and I can't offer a solution because I find the documentation to be too vague. Sorry. Good luck.
Here are some links you might find useful:
http://www.topxml.com/rbnews/.NET%20XML,%20System.XML/re-6959_Security-changes-in--NET-2-0-s--XSLT.aspx
http://www.vbfrance.com/codes/DOTNET-TRANSFORMATION-XSLT-FICHIER-XML-VB-NET_37120.aspx
http://sqljunkies.com/WebLog/mrys/articles/11321.aspx
http://www.thescripts.com/forum/thread172393.html
Correction: this code DOES work. In my case there were some leftover <asp:... elements in the document I was working on that was causing this error.