webmethod编码问题

发布于 2024-08-23 08:34:23 字数 273 浏览 2 评论 0原文

我在 .NET Web 服务中遇到了一个 n00b 问题。 WebMethod 返回类型正在对已编码的字符串进行编码(已由我的 xml 编写器编码)。

有办法关闭这个功能吗?

例子 webmethod 返回之前准备好的 xml

你好世界

但是客户端从 webmethod 响应接收到的 xml

你好世界

& 符号由 Web 方法编码

我正在使用 xmlwriter 对象来构建 xml...有人有解决方案吗?

I am facing a n00b issue in .NET webservices. the WebMethod return type is encoding an already encoded string (already encoded by my xml writer).

Is there a way to turn of this off?

Example
the prepared xml before the webmethod returns it
<p> Hello World </p>

but the xml received by the client from the webmethod response
<p> Hello World </P>

the ampersand is getting encoded by the web method

I am using xmlwriter object to build the xml... has anyone a solution to this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不语却知心 2024-08-30 08:34:23

我猜您正在将其发送到网页。您得到的是显示实际“<”的编码屏幕上的字符而不是 HTML 保留字符。

这些“<” '>'是 HTML 页面中供 HTML 解析器使用的保留字符。如果您想在页面中使用它们,请使用 <(小于)>(大于)。

尝试在每个 HTML 保留字符前面放置一个“\”。这是一个猜测,我不确定它是否有效。

I'm guessing you're sending this to a webpage. What you're getting is the encoding to show the actual '<' characters on the screen and not the HTML reserved characters.

These '<' '>' are reserved characters in a HTML page for the HTML parsers to use. If you want to use them in your page, you use < (lesser than) > (greater than).

Try putting a '\' in front of each of your HTML reserved character. This is a guess, I'm not sure that it'll work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文