• 简单的单页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;
            }
  • 相关阅读:
    源码解析之–网络层YTKNetwork
    ARC和非ARC文件混编
    Xcode真机调试中"There was an internal API error"错误解决方法
    设置textView或者label的行间距方法
    iOS中__block 关键字的底层实现原理
    使用AVCaptureSession捕捉静态图片
    使用AVCaptureSession显示相机预览
    短小强悍的JavaScript异步调用库
    开源中国愚人节网页变模糊的js blur代码
    undefined与null的区别
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835728.html
Copyright © 2020-2023  润新知