UrlEncode和UrlDecode
2015-12-05 09:28:42 访问(1535) 赞(0) 踩(0)
/// <summary>
///
/// </summary>
/// <param name="theValue"></param>
/// <returns></returns>
public static string UrlEncode(string theValue)
{
if (theValue == null || theValue.Length == 0)
return "";
if (HttpContext.Current == null)
return theValue;
return HttpContext.Current.Server.UrlEncode(theValue);
}
/// <summary>
///
/// </summary>
/// <param name="hc"></param>
/// <param name="theValue"></param>
/// <returns></returns>
public static string UrlEncode(HttpContext hc, string theValue)
{
if (theValue == null || theValue.Length == 0)
return "";
if (hc == null)
return theValue;
return hc.Server.UrlEncode(theValue);
}
/// <summary>
///
/// </summary>
/// <param name="theValue"></param>
/// <returns></returns>
public static string UrlDecode(string theValue)
{
if (theValue == null || theValue.Length == 0)
return "";
if (HttpContext.Current == null)
return theValue;
return HttpContext.Current.Server.UrlDecode(theValue);
}
/// <summary>
///
/// </summary>
/// <param name="hc"></param>
/// <param name="theValue"></param>
/// <returns></returns>
public static string UrlDecode(HttpContext hc, string theValue)
{
if (theValue == null || theValue.Length == 0)
return "";
if (hc == null)
return theValue;
return hc.Server.UrlDecode(theValue);
}
标签:
UrlEncode和UrlDecode 


上一条:
下一条:
相关评论
发表评论