2011-04-06 87 views
0

我在我的webform中使用Uploadify插件,并得到一个错误Http 302.我不知道这是怎么发生的以及如何解决它,任何人都帮我修复它。预先感谢。 这里是我的javascript代码:ASP.NET C#使用Uploadify的JQuery插件获取Http错误302

<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

我已经在web.config中启用此文件的安全性: – NevenHuynh 2011-04-06 10:32:19

0

删除

<authorization> 
    <allow users="*"/> 
    </authorization> 

从你的web.config,它会工作。

相关问题