Put HTML string in IFRAME in C# codebehind?
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 th开发者_如何学Ce 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.
The IFRAME will require a proper web resource - this can be a dynamic page that simply outputs your HTML blob.
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.
精彩评论