이미지를 데이터베이스에 저장하고 있으며 파일 경로 + ID를 사용하여 이미지를 표시하기 위해 이미지 핸들러를 사용하고 있습니다. 문제는 페이지를 통해 이미지를 업데이트 할 때 이미지가 변경되지 않는다는 것입니다. Wierd는 firefox 또는 chrome에이 문제가 없습니다.ASHX 이미지 처리기가 작동하지 않습니다. 즉, firefox 및 chrome에서 작동합니다.
ASHX 처리기
public void ProcessRequest(HttpContext context)
{
Guid image_id;
if (context.Request.QueryString["id"] != null)
image_id = System.Guid.Parse(context.Request.QueryString["id"]);
else
throw new ArgumentException("No parameter specified");
context.Response.ContentType = "image/jpeg";
Stream strm = GetImageFromDatabase(image_id);
if (strm != null)
{
byte[] buffer = new byte[4096];
int byteSeq = strm.Read(buffer, 0, 4096);
while (byteSeq > 0)
{
context.Response.OutputStream.Write(buffer, 0, byteSeq);
byteSeq = strm.Read(buffer, 0, 4096);
}
//context.Response.BinaryWrite(buffer);
}
}
사용자 제어 코드
string imagePath = "<a href=" + (Image.ImageUrl = "~/ShowImage.ashx?id=" + r["Image_id"]);
마크 업
<asp:UpdatePanel ID="Upd1" runat="server" UpdateMode="Always" >
<ContentTemplate>
<div id="mpe" style="width: 600px; padding: 5px;">
<uc2:IMG ID="IMG1" cssclass="bodycopy" runat="server" />
</div>
<asp:UpdateProgress ID="upp1" runat="server" AssociatedUpdatePanelID="Upd1">
<ProgressTemplate>
<div id="progressBackgroundFilter">
</div>
<div id="modalPopup">
Loading...
<img align="middle" src="../images/Ajax/loading_1.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
내가 여기에 게시 할 어떤 다른 코드 모르겠지만 내가 관련되어 있다고 생각하는 것입니다. 버튼을 클릭하여 이미지를 업데이트하면 데이터베이스의 행이 성공적으로 업데이트됩니다. 또한 이미지에 대한 데이터를 업데이트 할 수 있으며 올바르게 업데이트됩니다.
아이디어가 있으십니까?
을 돌려 또 다른 예 또는 아니?? –
이미지가 페이지로드시 즉, 이미지를 업데이트 할 때 이미지를 표시합니다. 이미지가 업데이트되면 이전 이미지가 표시되고 새 이미지는 표시되지 않습니다. –
아마도 캐싱 때문일 수 있습니다. 이걸보세요 ** http : //superuser.com/questions/81182/how-to-force-internet-explorer-ie-to-really-the-page* * –