Пример #1
0
 public string RequestQuerystring(string Target)
 {
     try
     {
         string[] ArrayData = RequestUrl.Substring(RequestUrl.IndexOf("?") + 1, RequestUrl.Length - RequestUrl.IndexOf("?") - 1).Split('&');
         for (int i = 0; i < ArrayData.Length; i++)
         {
             string[] ArrayTarget = ArrayData[i].Split('=');
             if (ArrayTarget[0] == Target)
             {
                 return(ArrayTarget[1]);
             }
         }
         return("");
     }
     catch
     {
         return("");
     }
 }
Пример #2
0
        private void SetFormAction()
        {
            var actionPath = Form.GetAttributeValue("action", null);

            if (string.IsNullOrEmpty(actionPath) || actionPath.Contains("://"))
            {
                FormAction = actionPath;
                return;
            }

            if (actionPath.StartsWith("//"))
            {
                var protocol = RequestUrl.StartsWith("https://") ? "https:" : "http:";
                FormAction = protocol + actionPath;
                return;
            }

            if (actionPath.StartsWith("/"))
            {
                var domain = RxDomain.Match(RequestUrl);

                if (!domain.Success)
                {
                    FormAction = RequestUrl + actionPath;
                    return;
                }

                FormAction = domain.Result("$1") + actionPath;
                return;
            }

            var lastdirectory = RequestUrl.LastIndexOf('/', 10);

            if (lastdirectory < 0)
            {
                FormAction = RequestUrl + '/' + actionPath;
                return;
            }

            FormAction = RequestUrl.Substring(0, lastdirectory + 1) + actionPath;
        }