0

I use the FileUpload to upload files.

but i note that :

in the second upload ,the session variables are cleared then log out !!

Why this strange behavior is happened when clicking on save button ?and how to fix it ?


if (fup_logoBannarFile.HasFile)
{
    try
    {
        bool IsExists = System.IO.Directory.Exists(Server.MapPath(path + ddl_dep.SelectedItem.Value.ToString()));
        if (!IsExists)
          System.IO.Directory.CreateDirectory(Server.MapPath(path + ddl_dep.SelectedItem.Value.ToString()));
          upload_file(fup_logoBannarFile, lbl_successMsg, "LogoBanner");
          load_images();
     }
     catch (Exception ex)
     {
          errorDiv.Visible = true;
          successDiv.Visible = false;
          lbl_msg.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
     }    
}
4

1 回答 1

1

您可以尝试将文件保存在您的网站或 iis 根目录之外。因为我猜替换您网站目录中的文件可能会清除会话

于 2012-11-21T09:07:11.513 回答