zoukankan      html  css  js  c++  java
  • swfupload 相关配置

    部署在IIS上出现404:

    修改 C:WindowsSystem32inetsrvconfigapplicationHost.config 文件

    连续查找requestFiltering,往下添加一行                        

    <requestLimits maxAllowedContentLength="1073741824" />

    里面的1073741824=1G。

    <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
         <fileExtensions allowUnlisted="true" applyToWebDAV="true">
           ................
         </fileExtensions>
    </requestFiltering>

     或者在本地web.config添加下面代码

    <configuration> 
     <system.webServer> 
       <security>
          <requestFiltering>
            <requestLimits maxAllowedContentLength="1073741824" />
          </requestFiltering>
        </security>
     </system.webServer>
    </configuration>

    另一种 404的可能性:

    路径要添加绝对路径http://www.xxxx.com/swfupload/…… 或者 http://192.168.1.34/swfupload/……

     flash_url: "http://www.xxxx.com/swfupload/swfupload.swf",
     upload_url:  "http://www.xxxx.com/swfupload/imageUp.ashx",
     button_image_url: "http://www.xxxx.com/swfupload/up.png",

    Web.Config要添加节点:

    maxRequestLength的大小根据自己的需求设置1024000~=1G

      <system.web>
               <httpRuntime maxRequestLength="1024000" executionTimeout="360" requestValidationMode="2.0" />
      </system.web>

    post_params 参数的设置:

    因SWFUpload上传需要自己开辟Session 所以要在Globals中添加处理

    post_params: {
        "ASPSESSID": "<%=Session.SessionID %>",
        "AUTHID": "<%=Request.Cookies[FormsAuthentication.FormsCookieName].Value%>" //微软MemberShip
    },

    Globals.asax文件添加

    Application_BeginRequest内添加

                try
                {
                    string session_param_name = "ASPSESSID";
                    string session_cookie_name = "ASP.NET_SESSIONID";
    
                    if (HttpContext.Current.Request.Form[session_param_name] != null)
                    {
                        UpdateCookie(session_cookie_name, HttpContext.Current.Request.Form[session_param_name]);
                    }
                    else if (HttpContext.Current.Request.QueryString[session_param_name] != null)
                    {
                        UpdateCookie(session_cookie_name, HttpContext.Current.Request.QueryString[session_param_name]);
                    }
                }
                catch (Exception)
                {
                    HttpContext.Current.Response.StatusCode = 500;
                    HttpContext.Current.Response.Write("Error Initializing Session");
                }
    
                try
                {
                    string auth_param_name = "AUTHID";
                    string auth_cookie_name = FormsAuthentication.FormsCookieName;
    
                    if (HttpContext.Current.Request.Form[auth_param_name] != null)
                    {
                        UpdateCookie(auth_cookie_name, HttpContext.Current.Request.Form[auth_param_name]);
                    }
                    else if (HttpContext.Current.Request.QueryString[auth_param_name] != null)
                    {
                        UpdateCookie(auth_cookie_name, HttpContext.Current.Request.QueryString[auth_param_name]);
                    }
    
                }
                catch (Exception)
                {
                    HttpContext.Current.Response.StatusCode = 500;
                    HttpContext.Current.Response.Write("Error Initializing Forms Authentication");
                }
            void UpdateCookie(string cookie_name, string cookie_value)
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(cookie_name);
                if (cookie == null)
                {
                    cookie = new HttpCookie(cookie_name);
                    HttpContext.Current.Request.Cookies.Add(cookie);
                }
                cookie.Value = cookie_value;
                HttpContext.Current.Request.Cookies.Set(cookie);
            }

    ---------------------如果以上都注意了,基本应该没什么问题

  • 相关阅读:
    PHP、JAVA、C#、Object-C 通用的DES加密
    xtraScrollableControl 滚动条随鼠标滚动
    C#让TopMost窗体弹出并置顶层但不获取当前输入焦点的终极办法
    C#获取“所有用户桌面”的路径
    C#如何获取快捷方式指向的目标文件
    10
    09
    新浪微博中tableview中头部信息
    ASIHTTPRequest类库简介和使用说明
    IOS常用设计模式之委托模式
  • 原文地址:https://www.cnblogs.com/zevfang/p/3998789.html
Copyright © 2011-2022 走看看