2012-01-28 130 views
0

我有问题,Uploadify:Uploadify:未登录的用户?

我使用登录项目:

FormsAuthentication.SetAuthCookie("myName", false); 

然后,我要上传一些文件:

 @{ 
     tring auth = @Request.Cookies[FormsAuthentication.FormsCookieName] 
        == null ? 
           string.Empty 
            : 
           Request.Cookies[FormsAuthentication.FormsCookieName].Value; 
     } 

     $("#fileuploader").uploadify({ 
      uploader: '@Url.Content("~/Scripts/uploadify.swf")', 
      script: '@Url.Action("ABF", "Upload")', 
      scriptData: { token: "@auth" }, 
      fileDataName: 'file', 
      buttonText: 'Upload file', 
      multi: false, 
      sizeLimit: 22222222222, 
      simUploadLimit: 1, 
      cancelImg: '@Url.Content("~/Images/uploadify-cancel.png")',    
      auto: true, 
      onError: function(event, queueID, fileObj, errorObj) { 
       $('#file-type-id-list').attr('disabled',''); 
       alert("Error ! Type: [" + errorObj.type + "] Info [" + errorObj.info + "]"); 
      }     
     }); 

我的控制器的动作:

[HttpPost] 
    public ActionResult ABF(HttpPostedFileBase file) 
    { 
     bool isLogged = User.Identity.IsAuthenticated; 
    } 

有什么好奇的,如果我通过uploadify的pos进入该动作t方法,isLoggedfalse。如果我将该操作更改为[HttpGet],并通过正常请求进入该操作,则isLoggedtrue。为什么?

回答