Aps.net—(利用C#来生成静态页面)

//主要用到了System.Net.WebClient类
 if (Request.QueryString["r"] != "1")
        {
            if (System.IO.File.Exists(Server.MapPath("/html/" + Request.QueryString["ID"] + ".html")))
            {
                Response.Redirect("/html/" + Request.QueryString["ID"] + ".html");
                return;
            }
            else
            {
                new System.Net.WebClient().DownloadFile("http://localhost/test.aspx?ID=" + Request.QueryString["ID"] + "&r=1", Server.MapPath("/html/" + Request.QueryString["ID"] + ".html"));
                Response.Redirect("/html/" + Request.QueryString["ID"] + ".html");
                return;
            }
            Response.Redirect("/html/" + Request.QueryString["ID"] + ".html");
            return;
        }


 
posted @ 2011-11-08 17:42  Bodi  阅读(280)  评论(0编辑  收藏  举报