ASPX page generates HTML

Source: Internet
Author: User

<summary>
ASPX generates HTML
</summary>
<param name= "Url" ></param>
<returns></returns>
public static string getaspxhtml (String Url)
{
string res = "";

StringWriter strhtml = new StringWriter ();
System.Web.UI.Page mypage = new Page (); There's a server object in System.Web.UI.Page, and we're going to use it.
MyPage.Server.Execute (URL, strhtml); Asp_net.aspx will read the HTML content displayed in the customer segment into the strHTML

res = strhtml.tostring ();
Strhtml.close (); Close StringWriter

StreamWriter SW = new StreamWriter (Path + FileName, True, System.Text.Encoding.GetEncoding ("GB2312"));
Create a new file test.htm, file format GB2312
Sw. Write (Strhtml.tostring ()); Write the characters in strhtml to Test.htm
Sw. Close (); Close StreamWriter
return true;

return res;
}

ASPX page generates HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.