Exemplo n.º 1
0
        /// <summary>
        /// 得到请求地址不包含域
        /// 格式:/api/user?参数1=参数值&参数2=参数值
        /// </summary>
        /// <param name="isSort">是否排序</param>
        /// <param name="isUrlEncode">是否url编码</param>
        /// <param name="encoding">编码格式,默认UTF8</param>
        /// <returns></returns>
        public string GetQueryPath(bool isSort = false, bool isUrlEncode = false, Encoding encoding = null)
        {
            var queryParam = GetQueryResult(isSort, isUrlEncode, encoding);

            if (!string.IsNullOrEmpty(queryParam))
            {
                return($"{RequestUrl.Replace(Scheme + "://" + Host, "")}?{queryParam}");
            }

            return($"{RequestUrl.Replace(Scheme + "://" + Host, "")}");
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到请求地址不包含域
 /// 格式:/api/user?参数1=参数值&参数2=参数值
 /// </summary>
 /// <param name="isSort">是否排序</param>
 /// <param name="isUrlEncode">是否url编码</param>
 /// <param name="encoding">编码格式,默认UTF8</param>
 /// <returns></returns>
 public string GetQueryPath(bool isSort = false, bool isUrlEncode = false, Encoding encoding = null)
 {
     return($"{RequestUrl.Replace(Host, "")}{GetQueryResult(isSort, isUrlEncode, encoding)}");
 }