2012-01-28 9 views
0

내가 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; 
    } 

무엇이 궁금합니다. t 방법 인 경우 isLoggedfalse입니다. 해당 작업을 [HttpGet]으로 변경하고 정상 요청으로 처리하면 isLoggedtrue입니다. 왜 ?

답변

0

좋아, 해결했습니다. scriptData 안에 하나의 필드를 추가하고 Global.asax 파일을 약간 수정해야했습니다. Here's the complete answer

관련 문제