• 简单的单页c#生成静态页源码


    protected void BtGroup_ServerClick(object sender, EventArgs e)
            {
                //产业群首页
                string tempGroupData = GetHttpData("http://www.goudiannao.com/Group/index.aspx");
                using (StreamWriter sw = new StreamWriter(this.Request.PhysicalApplicationPath + "Group\Index.html", false, System.Text.Encoding.GetEncoding("utf-8")))
                {
                    sw.Write(tempGroupData);
                    sw.Flush();
                }
            
            
            }
            public string GetHttpData(string sUrl)
            {
                string sRslt = null;
                WebResponse oWebRps = null;
                WebRequest oWebRqst = WebRequest.Create(sUrl);
                oWebRqst.Timeout = 50000;
                try
                {
                    oWebRps = oWebRqst.GetResponse();
                }           
             
                finally
                {
                    if (oWebRps != null)
                    {
                        StreamReader oStreamRd = new StreamReader(oWebRps.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
                        sRslt = oStreamRd.ReadToEnd();
                        oStreamRd.Close();
                        oWebRps.Close();
                    }
                }
                return sRslt;
            } 

  • 相关阅读:
    数据库(SQL Server)管理数据库表~新奇之处
    疯狂C#~伴随着我的库存管理¥
    书中的银行,我们一起奋斗的C#,只因乐在其中~
    MyBatis的经典案例
    Spring MVC的配置文件(XML)的几个经典案列
    Spring MVC注解的一些案列
    WebService的一些案例
    AOP面向切面编程的四种实现
    Struts 2的OGNL的根对象
    Struts 2的拦截器(Interceptor)总结
  • 原文地址:https://www.cnblogs.com/rr163/p/4011540.html
Copyright © 2020-2023  润新知