将 XML 数据和用户从 Coldfusion 页面传递到 .NET 页面

发布于 2024-10-10 09:13:04 字数 788 浏览 0 评论 0原文

我很感激有关这种情况的一些意见,我无法找出最好的方法来做到这一点。

我在 ColdFusion 应用程序和 CF 应用程序内的 IFrame 中准备了一些数据,我们希望显示在 .NET 端生成的一些图形(严格来说不是图像,而是整个页面)。我想将 XML 数据从 CF 端传递到 .NET 以及用户。

在 .NET 方面,我将数据放入会话中,以便用户可以筛选数据,而无需重新查询并从 CF 重新传递数据。

我尝试过:

  • 使用 CF 生成 XML,将其放入隐藏的表单字段中,自动提交(使用 JS)表单到 .NET 端。
    • 我使用这种方法遇到的问题是在表单帖子上完成的编码。该数据具有诸如 之类的条目。这是一个问题,因为它是 URL 编码、发布的,当我在 .NET 端获取它时,我得到 ,它的 XML 格式不正确.

我想避免的:

  • 中间数据库方法(将数据放入 CF 上的数据库中,然后使用 .NET 拾取) 我只想显示传递到页面的内容。我对数据的安全有顾虑,它非常敏感。
  • 将数据传递到 Web 服务,返回 GUID,使用 URL 参数转发用户以访问传入的数据。我认为如果有人偶然发现了该数据的链接,那就会有风险。我不能冒这个风险。

我本来想用JSON传递数据,但我对它很不熟悉。想法?

谢谢大家抽出时间。

I'd appreciate some input on this situation, I can't figure out the best way to do this.

I have some data that's being prepared for me in a ColdFusion app and in an IFrame within the CF app we want to display some graphs (not strictly an image, it's an entire page) being generated on the .NET side of things. I'd like to pass XML data from the CF side to .NET as well as the user.

On the .NET side I'm putting the data in a session so the user can sift through it without the need to have it re-queried and re-passed from CF.

What I've tried:

  • Generating XML with CF, putting it in a hidden form field, auto-submitting (with JS) a the form to the .NET side.
    • The issue I'm having with this approach is the encoding being done on the form post. The data has entries like <entry data="hello & goodbye">. It's an issue because it's being URL encdeded, Posted, and when I get it on the .NET side I get <entry data="hello & goodbye"> which isn't properly formed XML.

What I'd like to avoid:

  • An intermediary DB approach (dropping the data in a DB on CF, picking it up with .NET) I'd like to only display what is passed to the page. I have security concerns with the data, it's very sensitive.
  • Passing the data to a webservice, returning a GUID, forwarding the user with a URL Parameter to access the passed in data. I think that'd be risky if someone happened on a link to that data. I can't take that risk.

I was thinking of passing the data with JSON, but I'm very unfamiliar with it. Thoughts?

Thanks for your time folks.

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

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

发布评论

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

评论(1

许久 2024-10-17 09:13:04

您可以对隐藏字段执行您正在执行的操作,并在 .net 方面对其进行解码:

string xmlStuff = Request.Form["thexml"];
StringWriter sw = new StringWriter();
HttpUtility.HtmlDecode(xmlStuff, sw);
string decodedXMLStuff = sw.ToString();

这就是全部!从那里您可以将该 xml 字符串加载到 XDocument 或您正在使用的任何内容中。

You can do what you're doing with the hidden field and decode it on the .net side of things:

string xmlStuff = Request.Form["thexml"];
StringWriter sw = new StringWriter();
HttpUtility.HtmlDecode(xmlStuff, sw);
string decodedXMLStuff = sw.ToString();

That's all there is to it! From there you can load that xml string into an XDocument, or whatever you're using.

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