tags:

views:

364

answers:

2

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.

+1  A: 

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.

Mademoiselle Vagin Cul
@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.
bill weaver
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.
Mademoiselle Vagin Cul
+3  A: 

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

Oded
@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!
bill weaver