zoukankan      html  css  js  c++  java
  • 让火狐和chorme浏览器支持uploadify带Cookie上传

    /////////////////////让火狐和chorme浏览器支持uploadify上传/////////////////////////
    //jquery uploadify在ie下可以正常上传,在实现异步上传的时候,每一个文件在上传时都会提交给服务器一个请求。每个请求都需要安全验证,session和cookie的校验。是的,就是这样。由于jquery uploadify是借助flash来实现上传的,每一次向后台发送数据流请求时,ie会自动把本地cookie存储捆绑在一起发送给服务器。但firefox、chrome不会这样做,他们会认为这样不安全

    private void Application_BeginRequest(object sender, EventArgs e)
    {

    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 { }
    try
    {
    string auth_param_name = "AUTHID";
    string auth_cookie_name = System.Web.Security.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 { }

    }

  • 相关阅读:
    LayoutInflater(布局服务)
    FOTA升级
    APK安装过程及原理详解
    Context类型
    Android应用的persistent属性
    Notification(状态栏通知)详解
    Handler消息传递机制浅析
    Selenium HTMLTestRunner 无法生成测试报告的总结
    【python】远程使用rsa登录sftp,上传下载文件
    02.性能测试中的指标
  • 原文地址:https://www.cnblogs.com/jordan2009/p/2988914.html
Copyright © 2011-2022 走看看