服务器响应错误:异步文件上载控件的“未知服务器错误” [英] Server Response Error: 'Unknown Server error' for async file upload control
本文介绍了服务器响应错误:异步文件上载控件的“未知服务器错误”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
单击异步文件上传控件的浏览按钮时出现以下错误
服务器响应错误:'未知服务器错误'
是否要查看响应页面?
什么是根本原因?这是我的代码
When click on browse button of async file Upload Control i got the following error
Server Response Error: 'Unknown Server Error'
Do You want to see the response page?
Whats root cause ?Here is my Code
protected void fileUploadComplete(object sender, AsyncFileUploadEventArgs e)
{
if (fileUpload1.HasFile && IsValidPhoto(Convert.ToInt32(fileUpload1.PostedFile.ContentLength)))//Checks Valid Photo Type or not
{
Thread.Sleep(1000);
string newfilenameWithExt = "";
string ext = System.IO.Path.GetExtension(fileUpload1.FileName);
Bitmap bmpImg = null;
newfilenameWithExt = hdnFileNmWithoutExt.Value + ext;//hidden field value is set on Page load
if (hdnOldFileName.Value != "")//Old Picture is removed
{
string oldFilePath = Server.MapPath("~/") + "/storedata/" + "studentphotos/" + hdnOldFileName.Value;
FileInfo oldFile = new FileInfo(oldFilePath);
if (System.IO.File.Exists(oldFilePath))
System.IO.File.Delete(oldFilePath);
}
// Resize Image Before Uploading to Storedata
bmpImg = Resize_Image(fileUpload1.PostedFile.InputStream, 97, 120);
bmpImg.Save(Server.MapPath("~/") + "/storedata/" + "studentphotos/" + newfilenameWithExt, ImageFormat.Jpeg);
Session["ProfileImg"] = newfilenameWithExt;
loadStudentProfilePicture();//method to load studentprofilepicture
HttpResponse.RemoveOutputCacheItem("/personalDetails.aspx");
StudentApplication objStdFileUpload = new StudentApplication();
objStdFileUpload.StudentFormID = 0;
if (Session["FormId"] != DBNull.Value && Session["FormId"].ToString() != "")
objStdFileUpload.StudentFormID = Convert.ToInt32(Session["FormId"].ToString());
objStdFileUpload.StudentProfileImage = newfilenameWithExt;
if (objStdFileUpload.StudentFormID != 0)
objStdFileUpload.UpdateFileNameUploadByFormID();
}
}
推荐答案
检查这个
http://forums.asp.net/t/1751822.aspx?+Server+Response+Error+Unknown+Server+error+for+async+file+upload+control [ ^ ]
http://ajaxcontroltoolkit.codeplex。 com / workitem / 24963 [ ^ ]
http:// blog .mrt-web.com / 2010/12 / ajax-control-toolkit-asyncfileupload.html [ ^ ]
check this
http://forums.asp.net/t/1751822.aspx?+Server+Response+Error+Unknown+Server+error+for+async+file+upload+control[^]
http://ajaxcontroltoolkit.codeplex.com/workitem/24963[^]
http://blog.mrt-web.com/2010/12/ajax-control-toolkit-asyncfileupload.html[^]
这篇关于服务器响应错误:异步文件上载控件的“未知服务器错误”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文