此 XML 文档中禁止 DTD - 如何更改权限?
我正在使用需要 XML 配置文件的第 3 方 .NET 组件。 我正在 ASP.NET 应用程序中使用它。
使用以下 dtd 配置 XML 时出现错误:
<!DOCTYPE prod-config SYSTEM "cache-config.dtd">
错误如下:
出于安全原因,禁止 DTD 在此 XML 文档中。启用 DTD 处理设置ProhibitDtd XmlReaderSettings 上的属性设置为 false 并将设置传递到 XmlReader.Create 方法。
prod-config.dtd 与 XML 配置文件位于同一目录中。
我无权访问组件代码来修改 XmlReaderSettings、ProhibitDtd 等。 是否有其他方法可以修改或标记 XML 文件以允许访问 DTD?
(仅供参考,该组件是 Oracle Coherence .NET 客户端)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否需要指定 DTD?如果没有实际使用它,那么最简单的方法就是完全省略 DTD 声明。
Oracle 网站上的该页面表明该组件仅.NET 1.1 支持。我认为默认情况下拒绝 DTD 的行为在 .NET 1.1 和 .NET 2.0 之间发生了变化。如果您尝试使用.NET 2.0 运行,我建议您尝试降级。并行安装 1.1可能可行,但您可能需要破解配置以强制其使用所需的运行时版本。
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,我也遇到了同样的错误,我将行更改为:
并修复了错误。不知道为什么会这样,而且我可能会因此而遇到更多错误。
FWIW, I had this same error, and I changed the line to:
and fixed the error. No idea why that works, and I'll probably get more errors because of this.