Пример #1
0
        public static string BuildFormHtml(
            SortedDictionary <string, string> sParaTemp,
            string gateway,
            string strMethod,
            string strButtonValue)
        {
            Dictionary <string, string> dictionary1 = new Dictionary <string, string>();
            Dictionary <string, string> dictionary2 = Submit.BuildRequestPara(sParaTemp);
            StringBuilder stringBuilder             = new StringBuilder();

            stringBuilder.Append("<form id='alipaysubmit' name='alipaysubmit' action='" + gateway + "_input_charset=" + Submit._input_charset + "' method='" + strMethod.ToLower().Trim() + "'>");
            foreach (KeyValuePair <string, string> keyValuePair in dictionary2)
            {
                stringBuilder.Append("<input type='hidden' name='" + keyValuePair.Key + "' value='" + keyValuePair.Value + "'/>");
            }
            stringBuilder.Append("<input type='submit' value='" + strButtonValue + "' style='display:none;'></form>");
            stringBuilder.Append("<script>document.forms['alipaysubmit'].submit();</script>");
            return(stringBuilder.ToString());
        }
Пример #2
0
        public static XmlDocument SendGetInfo(
            SortedDictionary <string, string> sParaTemp,
            string gateway)
        {
            Encoding    encoding         = Encoding.GetEncoding(Submit._input_charset);
            string      str              = Submit.BuildRequestParaToString(sParaTemp, encoding);
            string      requestUriString = gateway + str;
            XmlDocument xmlDocument      = new XmlDocument();

            try
            {
                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString);
                httpWebRequest.Method = "get";
                XmlTextReader xmlTextReader = new XmlTextReader(httpWebRequest.GetResponse().GetResponseStream());
                xmlDocument.Load((XmlReader)xmlTextReader);
            }
            catch (Exception ex)
            {
                string xml = "<error>" + ex.Message + "</error>";
                xmlDocument.LoadXml(xml);
            }
            return(xmlDocument);
        }