得到一个WebResponse的流进IFRAME - 麻烦 [英] getting a webresponse stream into iframe - trouble

查看:177
本文介绍了得到一个WebResponse的流进IFRAME - 麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哎再次stackoverflowers

hey again stackoverflowers

我移植一个网站从旧的ASP(VBScript中),并有一定的stuuf我要的iFrame以保持旧的东西新的容器内工作。

I'm migrating a website from old ASP (in VBScript) and there's certain stuuf I have to iFrame as to keep the old stuff working inside a new container.

aspx页面上我有带有runat =server属性的iframe,使其在文件后面code可用。

on the aspx page I have an iFrame with the runat="server" attribute to make it available in the code behind file.

<iframe id="frmLoader" runat="server" scrolling="auto" width="100%" height="600px"></iframe>

现在的问题,以获得一定的功能我已经张贴到网页(从旧的网站),使之呈现不同的,从而提供给POST的响应。

now the issue, to get certain functionality I have to POST to a page (from the old site) to make it render differently and thus provide a response to the POST.

以下code所在在Page_Load与在POSTDATA对象过程中的参数

the following code resides in the Page_Load with of course parameters in the postData object

byte[] encData = new ASCIIEncoding().GetBytes(postData);

req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = encData.Length;

Stream dataStream = req.GetRequestStream();
dataStream.Write(encData, 0, encData.Length);
dataStream.Flush();
dataStream.Close();

WebResponse res = req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
string s = sr.ReadToEnd();
frmLoader.InnerHtml = s;

在这里痛苦的是,我似乎无法使串入iframe中。
调试我检查的东西是否应该出现,它应该,但它不:P

the pain here is that I can't seem to render the string into the iframe. with debugging I checked whether something should appear and it should, but it doesnt :p

任何人都知道我是怎么解析到iframe的字符串?

anyone know how I get the string parsed into the iframe?

此外,在iframe触发功能时,页面应该呆在那里,从原来的网站应对额外职位(旧ASP)
我一直在寻找,但没有找到答案。

additionally, when triggering functionality in the iframe, the page should stay there, with the response to additional posts from the original site (old asp) I've been looking, but not finding answers.

创建处理程序就意味着我要创建一个自定义的处理程序为每个旧网页我希望用呢?

creating a handler would mean I have to create a custom handler for every old page I wish to use then?

我不是说经历了深入的web开发:)

I'm not that experienced in in-depth webdevelopment :)

在旧的ASP previous开发商投入了大量的功能集成到1页,并通过消息后,我可以对这些函数调用,每次渲染不同的页面。

in old ASP the previous developers put a lot of functionality into 1 page and by using the post message I can call upon these functions, rendering a different page each time.

可处理程序,就像你说的,建接受了一堆参数变化后?

can a handler, like you said, be built to accept a bunch of parameters to vary the post?

编辑:

我只是在这里发现了另一问题。处理程序不能访问到其中的数据驻留使我需要它后会话。每有动作是一个不同的职位......

I just noticed another problem here. the handler does not have access to the session in which data resides to make the post I need it to. there's a different post per action ...

推荐答案

你有没有尝试过手动的?请尝试以下操作:

Have you tried this manually? Try the following:

<iframe>text</iframe>

这是如何显示在浏览器中?

How does that display in the browser?

这是因为IFRAME中不起作用这种方式。像img标签,它需要一个src属性说法,其中的内容从何而来。

It's because iframe doesn't work that way. Like an img tag, it needs a "src" attribute saying where the content comes from.

您可能能够创建一个ashx的文件(HttpHandler的),并把它做好自检并返回结果。然后,您的IFRAME将&LT; IFRAME SRC =yourHandler.ashx/方式&gt;

You may be able to create a .ashx file (HttpHandler), and have it do the POST and return the result. Your iframe would then be <iframe src="yourHandler.ashx"/>.

这篇关于得到一个WebResponse的流进IFRAME - 麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆