zoukankan      html  css  js  c++  java
  • 请求文件下载URL过长处理

    /*
     * PostNewWin
     * Author:ppchen
     */
    var PostNewWin = function(url){
        var urlArr = url.split("?");
        var postUrl = urlArr[0];
        var postData = urlArr[1];
        var iframe = document.getElementById("postData_iframe");
        if(!iframe){
            iframe = document.createElement("iframe");
            iframe.id = "postData_iframe";
            iframe.scr= "about:blank";
            iframe.frameborder = "0";
            iframe.style.width = "0px";
            iframe.style.height = "0px";
            
            var form = document.createElement("form");
            form.id = "postData_form";
            form.method = "post";
            form.target = "_blank";
            
            document.body.appendChild(iframe);
            iframe.contentWindow.document.write("<body>" + form.outerHTML + "</body>");
        }
        iframe.contentWindow.document.getElementById("postData_form").innerHTML = "<input name='postData' id='postData' type='text' value='" + postData + "'/>";
        iframe.contentWindow.document.getElementById("postData_form").action = postUrl;
        iframe.contentWindow.document.getElementById("postData_form").submit();
    };

    /// <summary>
    /// 从Form中取得参数
    /// Author:ppchen
    /// </summary>
    /// <returns>参数集合</returns>
    private NameValueCollection ParseFormData()
    {
        NameValueCollection sQueryString = new NameValueCollection();
        if (this.Request.Form.Count > 0 && this.Request.Form["postData"] != null)
        {
            string sPostData = this.Request.Form["postData"].ToString();
            sPostData = sPostData.Trim(new char[] { '&', ' ' });
            if (!string.IsNullOrEmpty(sPostData))
            {
                string[] sParameterList = sPostData.Split('&');
                for (int i = 0; i < sParameterList.Length; i++)
                {
                    string[] sParameter = sParameterList[i].Split('=');
                    for (int j = 0; j < sParameter.Length; j = j + 2)
                    {
                        sQueryString.Add(sParameter[j], HttpUtility.UrlDecode(sParameter[j + 1]));
                    }
                }
            }
        }
        return sQueryString;
    }

  • 相关阅读:
    281. Zigzag Iterator
    298. Binary Tree Longest Consecutive Sequence
    482. License Key Formatting
    361. Bomb Enemy
    373. Find K Pairs with Smallest Sums
    304. Range Sum Query 2D
    308. Range Sum Query 2D
    307. Range Sum Query
    303. Range Sum Query
    247. Segment Tree Query II
  • 原文地址:https://www.cnblogs.com/jordan2009/p/5955702.html
Copyright © 2011-2022 走看看