![]() |
|
|
#1 |
|
Guest
Posts: n/a
|
Proxy authentication when doing xsl transform
I am processing cXml orders and the xml begins with the following:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.017/ cXML.dtd"> I am attempting to use the following code to transform the xml: XslCompiledTransform transform = new XslCompiledTransform(); Stream resultStream = new MemoryStream(); XmlReader xslRdr = XmlReader.Create(new StringReader(xslSheet)); transform.Load(xslRdr); XmlReaderSettings xRdrSettings = new XmlReaderSettings(); xRdrSettings.ProhibitDtd = false; xRdrSettings.ValidationType = ValidationType.DTD; XmlReader xmlRdr = XmlReader.Create(cxmlFilename, xRdrSettings); transform.Transform(xmlRdr, null, resultStream); My problem is that in my organization, my test machine cannot access the url in the DOCTYPE without proxy authentication. I get this exception when running the code: "An error has occurred while opening external DTD 'http://xml.cxml.org/ schemas/cXML/1.2.017/cXML.dtd': The remote server returned an error: (407) Proxy Authentication Required." Can anyone point me to some examples of how to apply the proxy authentication? I attempted to create an XmlUriResolver with the proper proxy credentials, and passed that into the XmlReaderSettings.XmlResolver property, but that made no difference. I must be missing something easy. Any help would be appreciated. Thanks, Chris |
|
|
|
#2 |
|
Newbie
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
![]() |
Re: Proxy authentication when doing xsl transform
I realize this is a few months after original post, but I pulled out a little hair on this too, so I thought I would go ahead and post the answer for other googlers.
I basically solved this by telling the xmlReader to ignore the dtd section by setting the xmlreadersettings.xmlresolver to nothing. Otherwise the parser will try to resolve the URL and you'll run into nasty proxy errors. Note xmlStream is your file Dim settings As XmlReaderSettings = New XmlReaderSettings() 'ignore DocType or else the parser will try to resolve the dtd URI 'which will result in a Proxy 407 Authentication Required error settings.XmlResolver = Nothing settings.ProhibitDtd = False Dim xml As New XmlDocument Dim tr As XmlReader tr = XmlReader.Create(xmlStream, settings) xml.Load(tr) See this link for more details: http://forums.microsoft.com/MSDN/Sho...16539&SiteID=1 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Proxy authentication when doing xsl transform | Chris Dunaway | C#(C Sharp) | 2 | 24-09-2007 09:43 PM |
| 407 Proxy Authentication Required - Not using a Proxy | gallan | VC.NET | 1 | 05-09-2007 03:54 PM |
| Proxy authentication | Chris Buchan | Windows Server 2003 | 4 | 28-08-2007 11:08 AM |
| Proxy authentication | Chris Buchan | Windows Server 2003 | 0 | 28-08-2007 11:05 AM |
| Proxy authentication | Chris Buchan | Windows Server 2003 | 2 | 28-08-2007 07:27 AM |