Ho questa immagine nella mia pagina aspxvisualizzazione delle immagini con ashx Handler
<td>
<asp:Image ID="LargeImage" runat="server" Height="100" Width="100" />"
</td>
Nei miei aspx.cs, assegnato un ImageUrl a questa immagine
protected void uploadimage_Click(object sender, System.EventArgs e)
{
ImageUtils.uploadImage(Titletxt.Text, FileUpload.FileContent);
LargeImage.ImageUrl = "~/AvatarImageFetch.ashx?memberid=" + memberid.ToString();
}
Per qualche ragione, l'immagine doesn si presentano Ecco la mia ashx
public void ProcessRequest(HttpContext context)
{
SqlConnection myConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["FMMImages"].ConnectionString);
myConnection.Open();
string sql = "select largeimage from images_temp where [email protected]";
SqlCommand cmd = new SqlCommand(sql, myConnection);
int param;
int.TryParse(context.Request.QueryString["memberid"], out param);
cmd.Parameters.Add("@memberid", SqlDbType.Int).Value = param;
//cmd.Parameters.Add("@GuID", SqlDbType.UniqueIdentifier).Value = context.Request.QueryString["UID"].ToString();
cmd.CommandType = System.Data.CommandType.Text;
SqlDataReader dReader = cmd.ExecuteReader();
dReader.Read();
context.Response.BinaryWrite((byte[])dReader["largeimage"]);
dReader.Close();
myConnection.Close();
}
Inoltre, ho un punto di interruzione nel gestore ashx. Sembra che il conduttore non stia sparando.
è che nel file ashx stesso, o il codice dietro (cioè il file .ashx.cs)? – Richard