在c#和mysql中显示二进制数据而不是图像

在c#和mysql中显示二进制数据而不是图像,c#,mysql,asp.net,C#,Mysql,Asp.net,当试图显示存储在数据库中的图像时,会显示上面的结果,而不是图像。不知道为什么会出现此问题。在转换它或其他页面时是否存在任何问题。在另一个页面中,它工作,而在某些页面上则不工作 public void ProcessRequest(HttpContext context) { MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["ConString"

当试图显示存储在数据库中的图像时,会显示上面的结果,而不是图像。不知道为什么会出现此问题。在转换它或其他页面时是否存在任何问题。在另一个页面中,它工作,而在某些页面上则不工作

public void ProcessRequest(HttpContext context)
        {
            MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["ConString"].ConnectionString.ToString());
            // Create SQL Command 
            int adid= int.Parse(context.Request.QueryString["adid"]);
            int imgid = int.Parse(context.Request.QueryString["imgid"]);
            MySqlCommand cmd = new MySqlCommand();
            //cmd.CommandText = "Select i.image_id, i.image_name, i.image_byteImage, i.image_adId from images i,postadverties p where i.image_adId =@ID";
            cmd.CommandText = "SELECT image_id,image_byteImage FROM images WHERE image_adId="+ adid + " and image_id="+ imgid;
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.Connection = con;
            //MySqlParameter AdId = new MySqlParameter("@ID", MySqlDbType.Int32);
            //MySqlParameter imgid = new MySqlParameter("@imgid", MySqlDbType.Int32);
            //AdId.Value = 
            //imgid.Value = 
            //cmd.Parameters.Add(AdId);
            //cmd.Parameters.Add(imgid);
            con.Open();
            MySqlDataReader dReader = cmd.ExecuteReader();
            if (dReader.Read())
            {
                byte[] binaryimg = (byte[])dReader["image_byteImage"];
                string base64string = "data:image/jpeg;base64," + Convert.ToBase64String(binaryimg);
                context.Response.Write(base64string);
                context.Response.Flush();
                context.Response.End();
            }
            dReader.Close();
            con.Close();
        }