public WorkerRequestSettings(string urlRelativeToAppRoot, httpRequestMethods method) { if (urlRelativeToAppRoot == null) { throw new ArgumentNullException("url"); } // Fix up URLs that incorrectly start with / or ~/ if (urlRelativeToAppRoot.StartsWith("~/")) { urlRelativeToAppRoot = urlRelativeToAppRoot.Substring(2); } else if (urlRelativeToAppRoot.StartsWith("/")) { urlRelativeToAppRoot = urlRelativeToAppRoot.Substring(1); } // Parse out the querystring if provided string query = ""; int querySeparatorIndex = urlRelativeToAppRoot.IndexOf("?"); if (querySeparatorIndex >= 0) { query = urlRelativeToAppRoot.Substring(querySeparatorIndex + 1); urlRelativeToAppRoot = urlRelativeToAppRoot.Substring(0, querySeparatorIndex); } this._url = urlRelativeToAppRoot; this._queryString = query; this._httpMethodName = Enum.GetName(typeof(httpRequestMethods), method); }
public WorkerRequestSettings(string urlRelativeToAppRoot, httpRequestMethods method) { if (urlRelativeToAppRoot == null) throw new ArgumentNullException("url"); // Fix up URLs that incorrectly start with / or ~/ if (urlRelativeToAppRoot.StartsWith("~/")) urlRelativeToAppRoot = urlRelativeToAppRoot.Substring(2); else if (urlRelativeToAppRoot.StartsWith("/")) urlRelativeToAppRoot = urlRelativeToAppRoot.Substring(1); // Parse out the querystring if provided string query = ""; int querySeparatorIndex = urlRelativeToAppRoot.IndexOf("?"); if (querySeparatorIndex >= 0) { query = urlRelativeToAppRoot.Substring(querySeparatorIndex + 1); urlRelativeToAppRoot = urlRelativeToAppRoot.Substring(0, querySeparatorIndex); } this._url = urlRelativeToAppRoot; this._queryString = query; this._httpMethodName = Enum.GetName(typeof(httpRequestMethods), method); }