我在我的webform中使用了Uploadify插件并得到错误Http 302.我不知道这是怎么发生的以及如何修复它,任何人都帮我修复它。预先感谢。 这是我的javascript代码:
<link href="jscript/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<script src="jscript/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="jscript/uploadify/swfobject.js" type="text/javascript"></script>
<script src="jscript/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#custom_file_upload').uploadify({
'uploader': 'jscript/uploadify/uploadify.swf',
'script': 'admin_ServicesPhotosManager.aspx',
'cancelImg': 'jscript/uploadify/cancel.png',
'folder': 'Images/Uploads',
'fileExt': '*.jpg;*.gif;*.png',
'fileDesc': 'Image Files (.JPG, .GIF, .PNG)',
'multi': true,
'queueSizeLimit': 5,
'queueID': 'custom-queue',
'onSelectOnce': function (event, data) {
$('#status-message').text(data.filesSelected + ' files have been added to the queue.');
},
'onAllComplete': function (event, data) {
alert(data.filesUploaded + ' files uploaded successfully !');
window.location = 'admin_ServicesPhotosManager.aspx';
},
'onError': function (event, ID, fileObj, errorObj) {
alert(errorObj.type + ' Error: ' + errorObj.info + " file : " + fileObj.type);
}
});
});
</script>
和我的admin_servicephotosmanager.aspx代码:
<div id="status-message">
</div>
<div id="custom-queue">
</div>
<input type="file" id="custom_file_upload" name="file_upload" />
<a href="javascript:$('#custom_file_upload').uploadifyUpload();" class="file-upload">
</a>
最后是我的admin_servicephotosmanager.aspx.cs代码:
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Files["Filedata"] != null)
{
HttpPostedFile uploads = Request.Files["Filedata"];
MessageBox.Instance.DisplayMessageAndRefresh(uploads.ContentLength.ToString(), false);
}
}
更新我的web.config:
<location path="~/admin_ServicesPhotosManager.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
<httpRuntime executionTimeout="1800"
maxRequestLength="1048576"
useFullyQualifiedRedirectUrl="false"/>
</system.web>
<system.web>
<httpRuntime
executionTimeout="110"
maxRequestLength="102400"
requestLengthDiskThreshold="80"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="5000"
enableKernelOutputCache="true"
enableVersionHeader="true"
requireRootedSaveAsPath="true"
enable="true"
shutdownTimeout="90"
delayNotificationTimeout="5"
waitChangeNotification="0"
maxWaitChangeNotification="0"
enableHeaderChecking="true"
sendCacheControlHeader="true"
apartmentThreading="false" /></system.web>
有人帮我解决了http 302错误。提前谢谢。
答案 0 :(得分:0)
请求可能已被阻止,请检查您是否存在安全问题。
答案 1 :(得分:0)
删除
<authorization>
<allow users="*"/>
</authorization>
从你的web.config中,它可以正常工作。