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; }