2012-12-26 30 views
0

我正在一個網站上,用戶可以上傳文件/照片和上傳我正在使用uploadify控制 我正在添加登錄用戶ID和當前日期和年份到文件然後保存它,我已經將用戶ID保存在Session(Session [「userid」])中,它在IE和Chrome上工作正常,但是當我從Firefox運行它時,它顯示Session [「userid」] = null,並且因爲它沒有上傳文件,下面是我的代碼上傳文件FireFox Session Issue

public string UploadFile(HttpPostedFileBase fileData) 
     { 
      try 
      { 
       if (fileData != null && fileData.ContentLength > 0) 
       { 
        var root = AppDomain.CurrentDomain.BaseDirectory + @"Uploads\File\"; 
        var filname = fileData.FileName.Split('.')[0] + "_" + Session["userid"].ToString() + "_" + DateTime.Now.Day + DateTime.Now.Year + "." + fileData.FileName.Split('.')[1]; 
        var path = root + Path.GetFileName(filname); 

        //if (System.IO.File.Exists(path)) 
        // return "Upload Failed! A file with this name already exists.";      

        fileData.SaveAs(path); 

        return "1"; 
       } 
       return "file not selected."; 
      } 
      catch (Exception ex) 
      {   
       throw ex; 
      } 
     } 

雖然用戶的loggedIn但仍顯示其會話空

回答

0

也許你已經餅乾禁用你的火狐

+0

會話在FireFox的所有其他代碼中都可用,只有在這個特定的代碼中我沒有獲得會話 –