zoukankan      html  css  js  c++  java
  • aspx页面生成html

            /// <summary>
            /// aspx生成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(); //System.Web.UI.Page中有个Server对象,我们要利用一下它
                myPage.Server.Execute(Url, strHTML); //将asp_net.aspx将在客户段显示的html内容读到了strHTML中

                res = strHTML.ToString();
                strHTML.Close(); //关闭StringWriter

                //StreamWriter sw = new StreamWriter(Path + FileName, true, System.Text.Encoding.GetEncoding("GB2312"));
                ////新建一个文件Test.htm,文件格式为GB2312 
                //sw.Write(strHTML.ToString()); //将strHTML中的字符写到Test.htm中               
                //sw.Close(); //关闭StreamWriter
                //return true;               

                return res;
            }

  • 相关阅读:
    教务管理及教材订购系统设计文档
    Lambda Expression
    Domain logic approaches
    load data local to table
    Spring AOP Capabilities and Goals
    CDI Features
    java设计模式
    Spring RESTful
    ecipse 新建Android test project error
    Excel数据导出
  • 原文地址:https://www.cnblogs.com/chencidi/p/4006748.html
Copyright © 2011-2022 走看看