【问题标题】:ASP.NET c# Using Uploadify Jquery Plugin Get Http Error 302ASP.NET c# 使用 Uploadify Jquery 插件获取 Http 错误 302
【发布时间】:2011-04-06 08:34:30
【问题描述】:

我在我的网络表单中使用 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 错误。提前致谢。

【问题讨论】:

    标签: asp.net http uploadify


    【解决方案1】:

    请求可能被阻止,请检查您是否有安全问题。

    【讨论】:

      【解决方案2】:

      删除

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

      从您的 web.config 中,它将起作用。

      【讨论】:

        猜你喜欢
        • 2011-11-21
        • 2011-06-05
        • 1970-01-01
        • 2011-05-01
        • 1970-01-01
        • 2023-03-20
        • 1970-01-01
        • 1970-01-01
        • 2010-11-24
        相关资源
        最近更新 更多