hey again stackoverflowers
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.
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>
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.
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;
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
anyone know how I get the string parsed into the iframe?
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?
I’m not that experienced in in-depth webdevelopment 🙂
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?
EDIT:
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:
How does that display in the browser?
It’s because iframe doesn’t work that way. Like an img tag, it needs a “src” attribute saying where the content comes from.
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"/>.