Uploadify:未登录的用户?
问题描述:
我有问题,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
。为什么?