2011-04-06 107 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,它會工作。

相關問題