开发者

How to preview a html file without saving it?

Hy,

In my application I store a s开发者_如何学运维tring as content of a html file.

How can I preview this content (assuming that it's modified from original content) in browser but not having to save it local.

Update

And the preview to be in another tab or window.


You can create a preview page that just writes the html string to the response like so:

    protected void Page_Load(object sender, EventArgs e)
    {
        string htmlString = //initialise the string here
        Response.Write(htmlString);
        Response.End();
    }


Using the Control System.Windows.Forms.WebBrowser, you can preview your HTML with DocumentText

Example:

webBrowser1.DocumentText = "<HTML><BODY style=\" background-color:black\"></BODY></HTML>";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜