Hazel Mahmud

Hazel Mahmud

  • 1.4k
  • 315
  • 69.5k

serialization a fileupload

May 11 2015 9:24 PM
i have a problem where my fileupload gave an error as below image. how do i fix it.. i attach my code as well below. please someone help me. My session state is InProc.
 
 
 
aspx.cs code :
 
if (Session["FileUploadPerjanjian"] == null && FileUploadPerjanjian.HasFile)
{
Session["FileUploadPerjanjian"] = FileUploadPerjanjian;
lblperjanjian.Text = FileUploadPerjanjian.FileName;
}
//// Next time submit and Session has values but FileUpload is Blank
//// Return the values from session to FileUpload
else if (Session["FileUploadPerjanjian"] != null && (!FileUploadPerjanjian.HasFile))
{
FileUploadPerjanjian = (FileUpload)Session["FileUploadPerjanjian"];
lblperjanjian.Text = FileUploadPerjanjian.FileName;
}
//// Now there could be another sictution when Session has File but user want to change the file
//// In this case we have to change the file in session object
else if (FileUploadPerjanjian.HasFile)
{
Session["FileUploadPerjanjian"] = FileUploadPerjanjian;
lblperjanjian.Text = FileUploadPerjanjian.FileName;
 

Answers (2)