//主要用到了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;
}