将远程源代码(HTML)保存到本地!private void Page_Load(object sender, System.EventArgs e)
{    
将远程源代码(HTML)保存到本地!    
string Url = "http://dotnet.aspx.cc/Images/logoSite.gif";
将远程源代码(HTML)保存到本地!    
string StringFileName = Url.Substring(Url.LastIndexOf("/"+ 1);
将远程源代码(HTML)保存到本地!    
string StringFilePath = Request.PhysicalApplicationPath;
将远程源代码(HTML)保存到本地!    
if(!StringFilePath.EndsWith("/")) StringFilePath += "/";
将远程源代码(HTML)保存到本地!    MSXML2.XMLHTTP _xmlhttp 
= new MSXML2.XMLHTTPClass();
将远程源代码(HTML)保存到本地!    _xmlhttp.open(
"GET",Url,false,null,null);
将远程源代码(HTML)保存到本地!    _xmlhttp.send(
"");
将远程源代码(HTML)保存到本地!    
if( _xmlhttp.readyState == 4 )
{
将远程源代码(HTML)保存到本地!        
if(System.IO.File.Exists(StringFilePath + StringFileName)) 
将远程源代码(HTML)保存到本地!            System.IO.File.Delete(StringFilePath 
+ StringFileName);
将远程源代码(HTML)保存到本地!        System.IO.FileStream fs 
= new System.IO.FileStream(StringFilePath + StringFileName, System.IO.FileMode.CreateNew);
将远程源代码(HTML)保存到本地!        System.IO.BinaryWriter w 
= new System.IO.BinaryWriter(fs);
将远程源代码(HTML)保存到本地!        w.Write((
byte[])_xmlhttp.responseBody);
将远程源代码(HTML)保存到本地!        w.Close();
将远程源代码(HTML)保存到本地!        fs.Close();
将远程源代码(HTML)保存到本地!        Response.Write (
"文件已经得到。<br><a href='" + Request.ApplicationPath + StringFileName +"' target='_blank'>");
将远程源代码(HTML)保存到本地!        Response.Write (
"查看" + StringFileName + "</a>");
将远程源代码(HTML)保存到本地!    }

将远程源代码(HTML)保存到本地!    
else
将远程源代码(HTML)保存到本地!    Response.Write (_xmlhttp.statusText);
将远程源代码(HTML)保存到本地!    Response.End();
将远程源代码(HTML)保存到本地!}

将远程源代码(HTML)保存到本地!
将远程源代码(HTML)保存到本地!

相关文章: