Exemple #1
0
        /// <summary>
        /// Submits the form, specifying the request data, redirection action, and a range of valid response types.
        /// </summary>
        /// <param name="requestData">Contains the request data in <b>application/x-www-form-urlencoded</b> format.</param>
        /// <param name="autoRedirect"><b>true</b> if the request should be automatically redirected; <b>false</b> otherwise.</param>
        /// <param name="validTypes">Contains a list of acceptable response types.</param>
        /// <returns>The response from the server.</returns>
        /// <remarks>
        /// This overload allows all form request options to be specified.
        /// </remarks>
        protected WebResponse SubmitRequest(string requestData, bool autoRedirect, WebResponseType[] validTypes)
        {
            WebRequest request;

            if (Attributes.ContainsKey("method") && Attributes["method"].ToUpperInvariant() == "POST")
            {
                request = new PostWebRequest(ActionUrl, requestData, autoRedirect);
            }
            else
            {
                var builder = new UriBuilder(ActionUrl)
                {
                    Query = requestData,
                    Port  = -1
                };

                request = new GetWebRequest(builder.Uri, autoRedirect);
            }

            request.IsXmlHttpRequest = SubmitAsXmlHttpRequest;

            if (FormUrl != null)
            {
                request.Headers.Add(CommonHeaders.Referer, FormUrl.ToString());
            }

            return(WebResponseValidator.ValidateResponse(WebClient.SendRequest(request), validTypes, string.Format(CultureInfo.CurrentCulture, NScrapeResources.UnexpectedResponseOnFormSubmission, request.Destination)));
        }
Exemple #2
0
    protected override void ИнициализацияОкна()
    {
        //Установка скина
        winManag.Skin = "BarsBlue";

        string Url = ПолучитьПереданныйURL();

        Control userControl = null;

        if (!string.IsNullOrEmpty(Url))
        {
            try
            {
#if RELEASE
                FormUrl = FormUrl.ToLower().Replace('/', '_').Replace('.', '_');

                string typeName = string.Format("ASP.{0},WebApp_deploy", FormUrl);

                Type type = Type.GetType(typeName);

                userControl = LoadControl(type, null);
#else
                userControl = LoadControl(Url);
#endif
            }
            catch (Exception exc)
            {
                throw new Exception("Не удалось загрузить данный раздел", exc);
            }
        }

        if (userControl == null)
        {
            this.Title = "Данный раздел не реализован";

            this.Controls.Add(new LiteralControl("<h4 class='middleheader'>Извините, данный раздел пока еще не реализован в системе</h4>"));
            return;
        }

        if (userControl is ВебФорма)
        {
            ВебФорма форма = (userControl as ВебФорма);

            this.Title = форма.ЗаголовокСтраницы;

            form_main.Controls.AddAt(4, userControl);
        }

        winManag.Behavior = RadWindowBehaviorFlags.Close | RadWindowBehaviorFlags.Reload;
    }