-1
我有ASP.NET MVC应用程序中,我使用HTTP处理程序ashx的文件,以获取网页上的图像。该图像是由用户通过扫描文档上传的。有时图像不显示为只有一个用户
现在我的问题是它的显示,除了一个,用户的报告,他是无法看到,即使它成功地加载图像,当我检查了日志,它表明了服务器的图像的每个用户。 没有出现异常的服务器登录,同时将图像太:( 一件事,这是频繁发生,70%的时间用户无法看到的页面图像。30%的时间,他成功地看到图像... 奇怪的问题 请咨询可能是什么问题?
下面是我的代码
public class GetImage : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
public GetImage()
{
}
public void ProcessRequest(HttpContext context)
{
if (context != null)
{
if (!string.IsNullOrEmpty(context.Request.Params["side"]))
{
bool isFront = false;
if (context.Request.Params["side"].Equals("Front"))
{
isFront = true;
}
else
{
isFront = false;
}
ICache Cache = CacheManager.SessionCache;
DepositState depState = (DepositState)Cache[Constants.DepositSession];
if (depState != null)
{
byte[] imageByteArray = null;
System.IO.MemoryStream imageMemoryStream = null;
try
{
if (isFront)
{
imageByteArray = System.Convert.FromBase64String(depState.FrontJpegBase64);
}
else
{
imageByteArray = System.Convert.FromBase64String(depState.BackJpegBase64);
}
imageMemoryStream = new System.IO.MemoryStream(imageByteArray);
using (System.Drawing.Image img = System.Drawing.Image.FromStream(imageMemoryStream))
{
img.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
catch(Exception ex)
{
Log.Error(Constants.DefaultErrorCode, "Exception occured while converting image to Base 64 in GetImage.ashx.cs" + ex);
}
imageMemoryStream.Close();
context.Response.Flush();
}
else
{
Log.Error(Constants.DefaultErrorCode, " Deposit State object is nullin GetImage.ashx ");
}
}
}
else
{
Log.Error(Constants.DefaultErrorCode, "Context is null in the Process Request ");
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
没有你看到你的代码,我们无能为力。 – jfar 2010-06-30 21:21:33
也不知道其他具体问题,如用户浏览器和配置,以及图像本身的链接。 但是,大部分可能不是必需的。该用户是否看到其他图像?如果你给他们直接链接到图像会发生什么? – NotMe 2010-06-30 21:26:06
@jfar和克里斯,我已经更新了建议的帖子 – batwadi 2010-06-30 21:30:43