473,785 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

network error during dtd validation

I'm getting weird errors during transformations --
"System.Net.Web Exception. The remote server returned an error: (500)
Internal Server Error."

I'm on the 1.0 Framework. I've looked through the stack trace and it seems
to be happending at a call to .Transform as follows (see stack trace below):
oXslTransform.T ransform(myXPat hDocument,plist ,stWrite);

These XML documents are 3rd party and include a doctype that refers to a dtd
across the network. I'm also getting these sometimes in IE, so it seems
that the vendors DTD is timing out. Is there anyway to disable the
validation of the document, so it doesn't try to call out to the DTD?

Thanks,
Galen

Here's a part of the stack trace:
at System.Net.Http WebRequest.Chec kFinalStatus()
at System.Net.Http WebRequest.EndG etResponse(IAsy ncResult asyncResult)
at System.Net.Http WebRequest.GetR esponse()
at System.Xml.XmlD ownloadManager. GetNonFileStrea m(Uri uri, ICredentials
credentials)
at System.Xml.XmlD ownloadManager. GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlU rlResolver.GetE ntity(Uri absoluteUri, String role, Type
ofObjectToRetur n)
at System.Xml.Sche ma.DtdParser.Pa rseDocTypeDecl( )
at System.Xml.Sche ma.DtdParser.Pa rse()
at System.Xml.XmlT extReader.Parse Dtd(XmlScanner scanner)
at System.Xml.XmlT extReader.Parse Tag()
at System.Xml.XmlT extReader.Parse Root()
at System.Xml.XmlT extReader.Read( )
at System.Xml.XmlV alidatingReader .ReadWithCollec tTextToken()
at System.Xml.XmlV alidatingReader .Read()
at System.Xml.XPat h.XPathDocument .ReadChildNodes (XPathContainer parent,
String parentBaseUri, XmlReader reader, PositionInfo positionInfo)
at System.Xml.XPat h.XPathDocument .Load(XmlReader reader)
at System.Xml.XPat h.XPathDocument .Init(XmlReader reader)
at System.Xml.XPat h.XPathDocument ..ctor(TextRead er reader)

Nov 11 '05 #1
5 4296
Galen Harris wrote:
I'm getting weird errors during transformations --
"System.Net.Web Exception. The remote server returned an error: (500)
Internal Server Error."

I'm on the 1.0 Framework. I've looked through the stack trace and it seems
to be happending at a call to .Transform as follows (see stack trace below):
oXslTransform.T ransform(myXPat hDocument,plist ,stWrite);

These XML documents are 3rd party and include a doctype that refers to a dtd
across the network. I'm also getting these sometimes in IE, so it seems
that the vendors DTD is timing out. Is there anyway to disable the
validation of the document, so it doesn't try to call out to the DTD?


In your scenario XML document is not validated actually. DTD is not only about
validation and XPathDocument class has additional requirements about entities
expansion etc, so I don't think it's good idea (if it's feasible at all) to
disable the above behaviour. Instead you can have local version of the DTD in
a file and just to redirect reader to it instead of remote version. Here is
small example:

static void Main(string[] args) {
string xml =
@"<!DOCTYPE root SYSTEM ""http://nowhere.com/my.dtd"">
<root>
<foo/>
<bar/>
</root>";
XmlReader reader = new XmlTextReader(n ew StringReader(xm l));

XmlValidatingRe ader vr = new XmlValidatingRe ader(reader);
vr.XmlResolver = new MyResolver();
vr.ValidationTy pe = ValidationType. None;
XPathDocument doc = new XPathDocument(v r);
...
}

public class MyResolver : XmlUrlResolver {
public override object GetEntity(Uri absoluteUri, string role, Type
ofObjectToRetur n) {
if (absoluteUri.Ab soluteUri.Start sWith("http://nowhere.com"))
return File.OpenRead(@ "c:\local.dtd") ;
else
return null;
}
}

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
thanks for the response.

what would you suggest, if the xml documents were 3rd party, and i couldn't
edit their contents to change the reference to a local copy of the DTD?
"Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Galen Harris wrote:
I'm getting weird errors during transformations --
"System.Net.Web Exception. The remote server returned an error: (500)
Internal Server Error."

I'm on the 1.0 Framework. I've looked through the stack trace and it seems to be happending at a call to .Transform as follows (see stack trace below): oXslTransform.T ransform(myXPat hDocument,plist ,stWrite);

These XML documents are 3rd party and include a doctype that refers to a dtd across the network. I'm also getting these sometimes in IE, so it seems
that the vendors DTD is timing out. Is there anyway to disable the
validation of the document, so it doesn't try to call out to the DTD?
In your scenario XML document is not validated actually. DTD is not only

about validation and XPathDocument class has additional requirements about entities expansion etc, so I don't think it's good idea (if it's feasible at all) to disable the above behaviour. Instead you can have local version of the DTD in a file and just to redirect reader to it instead of remote version. Here is small example:

static void Main(string[] args) {
string xml =
@"<!DOCTYPE root SYSTEM ""http://nowhere.com/my.dtd"">
<root>
<foo/>
<bar/>
</root>";
XmlReader reader = new XmlTextReader(n ew StringReader(xm l));

XmlValidatingRe ader vr = new XmlValidatingRe ader(reader);
vr.XmlResolver = new MyResolver();
vr.ValidationTy pe = ValidationType. None;
XPathDocument doc = new XPathDocument(v r);
...
}

public class MyResolver : XmlUrlResolver {
public override object GetEntity(Uri absoluteUri, string role, Type
ofObjectToRetur n) {
if (absoluteUri.Ab soluteUri.Start sWith("http://nowhere.com"))
return File.OpenRead(@ "c:\local.dtd") ;
else
return null;
}
}

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #3
Galen Harris wrote:
thanks for the response.

what would you suggest, if the xml documents were 3rd party, and i couldn't
edit their contents to change the reference to a local copy of the DTD?


Sorry, but you don't have to edit their content! Reread my post, the
whole idea is just to redirect the XML reader to local copy of DTD
instead on remote one, based on DTD URL.
It's well known and well proven technology (derived from SGML catalogs
and XCatalogs), it's standard when working with big DTDs like Docbook DTD.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #4
went back and looked at your posting again. i tried it, and it works great.
also, i noticed that i could set the XMLResolver property to null, and that
did the trick as well. i guess this would be easier in cases where i didn't
need anything from the DTD.

thanks for your help!
Nov 11 '05 #5
went back and looked at your posting again. i tried it, and it works great.
also, i noticed that i could set the XMLResolver property to null, and that
did the trick as well. i guess this would be easier in cases where i didn't
need anything from the DTD.

thanks for your help!
Nov 11 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5063
by: SteveS | last post by:
Hello all. This problem is stumping me.... I run a page called "default.aspx". For some reason when I execute this page, I get the error below. It seems to run through the entire code behind just find (including all the sql steps), but after the Page_Load() event I get this error. I really don't know why. Any ideas? ================================================================== General network error. Check your network...
11
45295
by: TheBurgerMan | last post by:
Hi all. I am using W2K3, .NET2 on a machine running AD and Exchange. I started getting the message below last week. I googled the error and not much was returned, but I did find this; http://forums.asp.net/918725/ShowPost.aspx I tried both items in the forum and it works for a few hits then it happens again! Anyone have the same problem? How do I fix this?
0
2158
by: info | last post by:
Hi, Is it possible to include in the Schema validation file, every custom error message for each validation rules? This mean, in the same xsd file we can have the validation rules (patterns) and the custom error message throw during validation for the end user. I know .NET enable it using errorMessage tag, but with a standard W3C java validation ... If is it possible, does it works in IE too? Like that the same XSD file could be...
2
2177
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/in configuration or <%@ Page EnableEventValidation="true"...
1
1806
by: Nathan Sokalski | last post by:
When I click after about 15 minutes on a page I wrote I recieve the following error: Server Error in '/' Application. -------------------------------------------------------------------------------- Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKeyconfiguration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
0
2192
by: johnkamal | last post by:
Hi, Some times while opening a page, I am getting the following error message, Please help me to rectify the problem. Server Error in '/' Application. General network error. Check your network documentation. 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...
6
2693
by: =?Utf-8?B?VGlt?= | last post by:
I have an app that calls a webmethod. Everything works fine except when you, the client, loses network connectivity during the request. When the connection is lost the client applications hangs. I tried setting the Timeout property on the client but still an error is never raised. Is there a workaround for this?
2
19492
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
2897
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.