小弟入门.net不久,但很想实现生成静态页面,不知道如何做,希望路过的朋友能指定迷津,谢谢!!

解决方案 »

  1.   

    http://cn469.cnblogs.com/articles/363386.html
      

  2.   

    http://yefei520.cnblogs.com/archive/2006/02/14/330163.aspx
      

  3.   

    一种方法
    string url = "http://www.xxx.net/index.aspx";
    string text;
    System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
    // Get the response instance.
    System.Net.WebResponse wResp =wReq.GetResponse();
    // Read an HTTP-specific property
    //if (wResp.GetType() ==HttpWebResponse)
    //{
    //DateTime updated  =((System.Net.HttpWebResponse)wResp).LastModified;
    //}
    // Get the response stream.
    System.IO.Stream respStream  = wResp.GetResponseStream();
    // Dim reader As StreamReader = New StreamReader(respStream)
    System.IO.StreamReader reader = new System.IO.StreamReader(respStream, System.Text.Encoding.GetEncoding("gb2312"));
    text=reader.ReadToEnd();
    // Create an instance of StreamWriter to write text to a file.
    // The using statement also closes the StreamWriter.
    string path = System.Web.HttpContext.Current.Server.MapPath("default.htm");
    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path,false,System.Text.Encoding.UTF8)) 
    {
    // Add some text to the file.
    if(text.Trim() !="")
    {
    sw.Write(text);
    }
    }第二种方法
    编写一个模板,替换里面的内容。
      

  4.   

    98star   你看这里边说法可以吗??http://community.csdn.net/Expert/topic/4912/4912693.xml?temp=.8947107
      

  5.   

    98star  您有做过生成静态的页面吗?