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方法,isLogged
是false
。如果我將該操作更改爲[HttpGet]
,並通過正常請求進入該操作,則isLogged
爲true
。爲什麼?