Пример #1
0
        public void SaveRequest()
        {
            if (_Request == null || _Section == "")
                return;

            RequestXml requestXml = new RequestXml();
            if (_Request.Method != null)
                requestXml.Method = _Request.Method;
            if (_Request.ContentType != null)
                requestXml.ContentType = _Request.ContentType;
            if (_Request.AllowAutoRedirect != null)
                requestXml.AllowAutoRedirect = _Request.AllowAutoRedirect;
            if (_Request.KeepAlive != null)
                requestXml.KeepAlive = _Request.KeepAlive;
            if (_Request.UserAgent != null)
                requestXml.UserAgent = _Request.UserAgent;

            RequestXml.SaveRequest(_Section, requestXml);
        }
Пример #2
0
        public static void SaveRequest(string section, RequestXml request)
        {
            if (section == null || section == "" || request == null)
                return;

            string fileName = ConfigHelper.GetConfigByKey("WebInfoFile");

            if (!String.IsNullOrEmpty(fileName))
            {
                XDocument myXDoc = new XDocument(
                    new XElement(section,
                        new XElement("LoginUrl", request._LoginUrl),
                        new XElement("Method", request._Method),
                        new XElement("ContentType", request._ContentType),
                        new XElement("AllowAutoRedirect", request._AllowAutoRedirect),
                        new XElement("KeepAlive", request._KeepAlive),
                        new XElement("Content", request._Content),
                        new XElement("Parameters", request._Parameters),
                        new XElement("UserAgent", request._UserAgent)
                       )
                );
                myXDoc.Save(fileName);
            }
        }