0

In a C# codebehind, i am calling a web service that returns an HTML blob that i need to stick in an IFRAME. I suppose that i can write it to a temporary file and point the IFRAME src to that, but is there a way to either (a) write the string to the IFRAME directly, (b) point the IFRAME src to the string somehow (maybe with streams), or (c) some other way?

I want to avoid writing this string to a file.

2 Answers 2

3

The IFRAME will require a proper web resource - this can be a dynamic page that simply outputs your HTML blob.

Sign up to request clarification or add additional context in comments.

1 Comment

@Oded - Of course! That's so obvious... not sure what i was thinking. So, point src to an .aspx file that calls the web service and Response.writes the results. No temp files involved!
1

if you save the HTML blob to a file, say www.your-site.com/data/file1.html and then change the iframe src with something like:

window.frames["NameOfYourIFrame"].src = 'www.your-site.com/data/file1.html';

it should work just fine.

2 Comments

@Racebacon - Yeah, that's what i was thinking, but the question is how to get the string directly into the IFRAME without writing it to an actual file. The goal being to avoid writing a bazillion temporary files.
well, if you use iframe, you have to use a file. However, you could change the <iframe> for a <div>, then you simply replace the HTML within that div without having to use a temp file, it would probably be faster, but I don't know why you use a IFrame in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.