图片只显示了一半?为什么?

using  System;
using  System.Data;
using  System.Configuration;
using  System.Collections;
using  System.Web;
using  System.Web.Security;
using  System.Web.UI;
using  System.Web.UI.WebControls;
using  System.Web.UI.WebControls.WebParts;
using  System.Web.UI.HtmlControls;
using  System.Net;
using  System.IO;

public   partial   class  img : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    
{

        
        

        WebRequest request 
= WebRequest.Create("http://bbs.rulaionline.com/RLVerifyCode.aspx");
        
// If required by the server, set the credentials.
        request.Credentials = CredentialCache.DefaultCredentials;
        
// Get the response.
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        
//int Length = int.Parse(response.ContentLength.ToString());


        
// Display the status.
        Console.WriteLine(response.StatusDescription);
        
// Get the stream containing content returned by the server.
        Stream dataStream = response.GetResponseStream();
        
//int Length = 10000000;
        
// Open the stream using a StreamReader for easy access.
        
//===========================

        
int read=0;
        
byte[] Content = new byte[8080];
        BinaryReader reader 
= new BinaryReader(dataStream);


        reader.Read(Content, 
0, Content.Length);
            

        Response.BinaryWrite(Content);

            
        
       




        
//===========================
        
//byte[] Content = new byte[Length];
        
//dataStream.Read(Content, 0, Length);

        
//输出到页面

        
//Response.BinaryWrite(Content);//图片数据





        
//StreamReader reader = new StreamReader(dataStream);
        
// Read the content.
        
//string responseFromServer = reader.ReadToEnd();
        
// Display the content.
        
//Response.Write(responseFromServer);
        
//Response.Write(dataStream);
        
// Cleanup the streams and the response.
        reader.Close();
        dataStream.Close();
        response.Close();

    }

}

 

你可能感兴趣的:(图片只显示了一半?为什么?)