Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

Proxy authentication when doing xsl transform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Dunaway - 21 Sep 2007 20:17 GMT
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
Marc Gravell - 22 Sep 2007 09:49 GMT
I too would have looked at the XmlUrlResolver route; however, another
option might be to well .Net about your proxy - then *all* code should
be able to find it:
You can do this either in your local app.config/web.config, or at the
machine level if you have a lot of apps

http://support.microsoft.com/default.aspx?scid=kb;en-us;318140

Marc
Chris Dunaway - 24 Sep 2007 16:04 GMT
> I too would have looked at the XmlUrlResolver route; however, another
> option might be to well .Net about your proxy - then *all* code should
[quoted text clipped - 5 lines]
>
> Marc

Thanks for the response.  But really, I didn't want to validate the
DTD in the first place.  I needed the proxy authentication because of
the DTD.

I resolved the issue by setting the XmlResolver property of the
XmlReaderSettings object to null.

Thanks again,

Chris

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.