English 中文(简体)
DTD is prohibited in this XML document -- how to change permissions?
原标题:

I am using a 3rd-party .NET component which requires an XML configuration file. I m am using this in an ASP.NET application.

I get an error when configure the XML with the following dtd:

<!DOCTYPE prod-config SYSTEM "cache-config.dtd">

The error is as follows:

For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method.

prod-config.dtd is sitting in the same directory as the XML config file.

I don t have access to the component code to modify XmlReaderSettings, ProhibitDtd etc. Is there anotherway I can modify or tag the XML file to permit the DTD to be accessed?

(FYI, the component is Oracle Coherence .NET client)

问题回答

Do you need to specify the DTD at all? If nothing is actually using it, then it would be simplest to just omit the DTD declaration altogether.

Ths page on Oracle s site suggests the component is only supported on .NET 1.1. I think the behaviour of refusing DTDs by default changed between .NET 1.1 and .NET 2.0. If you are tryingt run with .NET 2.0, I suggest you try downgrading. Installing 1.1 side-by-side might work but you may ned to hack the configuration to force it to use the desired runtime version.

FWIW, I had this same error, and I changed the line to:

<!DOCTYPE prod-config "cache-config.dtd">

and fixed the error. No idea why that works, and I ll probably get more errors because of this.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签