zoukankan      html  css  js  c++  java
  • 简单的单页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;
            } 

  • 相关阅读:
    架构师如何才能够设计一个安全的架构
    Google Analytics实用用小技巧
    如何从Linux系统中删除用户账户
    使用C++编译器的编译流程
    JavaScript中双叹号的使用实例
    Android合并文件的三种方式代码
    自学Linux命令的四种方法
    前端工程师必备实用网站
    给 iOS App 开发者的 39 个开源的 Swift UI 库
    关于iOS项目的一本书
  • 原文地址:https://www.cnblogs.com/rr163/p/4011540.html
Copyright © 2011-2022 走看看