本文介绍了如何在WCF数据服务AtomPub源上设置自定义内容类型响应标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我开发并托管通过ATOM Feeds提供数据的WCF数据服务。我使用XmlHttpRequest对象异步加载数据。不幸的是在IE 8中我总是得到一个空的xml文档。它似乎是IE
的一种行为(或更好的说是bug?),它只在响应内容类型为text / xml时才加载xml数据。 ATOM提要的内容类型总是类似于application / atom + xml。

I develop and host a WCF Data Services that delivers data via ATOM Feeds. I use the XmlHttpRequest object to load the data asynchronously. Unfortunately in IE 8 I always get an empty xml document. It seems to be a behavior (or better say bug?) of the IE that it does only load xml data when the response content-type is text/xml. The content-type of the ATOM feed is always something like application/atom+xml.

我的想法是将响应内容类型设置为 代码中的text / xml。我试图通过多种方式来管理它,但结果仍然是内容类型始终是application / ....。

The idea I had is to set the response content-type to  text/xml in code. I tried to manage this in several ways, but the result remains that the content-type is always application/... .

是否有人知道如何实现这一点。

Does anybody knows how to achieve this.

欢迎任何提示

问候

Rolf Cerff

Rolf Cerff

推荐答案

请注意,其他浏览器都有
DOMParser
也可以执行此操作。

Note that other browsers have an DOMParser object to do this as well.


这篇关于如何在WCF数据服务AtomPub源上设置自定义内容类型响应标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 21:23
查看更多