通过流获取Internet上的文件
HttpWebRequest httprequest = null;
HttpWebResponse httpresponse = null;
Stream sr = null;
//try
//{
httprequest = (HttpWebRequest)WebRequest.Create("http://donor.km169.net/music/200410/5189.wma");
httpresponse = (HttpWebResponse)httprequest.GetResponse();
httpresponse = (HttpWebResponse)httprequest.GetResponse();
Stream stream = httpresponse.GetResponseStream();
byte[] _byte = new byte[1024];
int length,_length;
FileStream fs = new FileStream(Server.MapPath("~/images/ty.wma"), FileMode.Create);
_length=stream.Read(_byte, 0, 1024);
while (_length > 0)
{
fs.Write(_byte, 0, _length);
_length = stream.Read(_byte, 0, 1024);
}
fs.Flush();
fs.Close();
stream.Close();
Response.Write("<script>alert(1);</script>");
HttpWebResponse httpresponse = null;
Stream sr = null;
//try
//{
httprequest = (HttpWebRequest)WebRequest.Create("http://donor.km169.net/music/200410/5189.wma");
httpresponse = (HttpWebResponse)httprequest.GetResponse();
httpresponse = (HttpWebResponse)httprequest.GetResponse();
Stream stream = httpresponse.GetResponseStream();
byte[] _byte = new byte[1024];
int length,_length;
FileStream fs = new FileStream(Server.MapPath("~/images/ty.wma"), FileMode.Create);
_length=stream.Read(_byte, 0, 1024);
while (_length > 0)
{
fs.Write(_byte, 0, _length);
_length = stream.Read(_byte, 0, 1024);
}
fs.Flush();
fs.Close();
stream.Close();
Response.Write("<script>alert(1);</script>");