Files
Common-VS2019/SacsStandardBase/Base/Utils/WebUtil.cs
T
2021-05-05 15:36:28 +01:00

46 lines
1.6 KiB
C#

using Sarand.Net.Standard.Base.Core;
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
namespace Sarand.Net.Standard.Base.Utils
{
public static class WebUtil
{
//-------------------------------------------------------------------
// H T M L E n c o d i n g
//-------------------------------------------------------------------
/// <summary>Converts a string to an HTML-encoded string.</summary>
public static String HtmlEncode (this String value)
{
if (StringUtil.IsEmpty(value)) return value;
return WebUtility.HtmlEncode(value);
}
/// <summary>Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.</summary>
public static String HtmlDecode (this String value)
{
if (StringUtil.IsEmpty(value)) return value;
return WebUtility.HtmlDecode(value);
}
//-------------------------------------------------------------------
// U R L E n c o d i n g
//-------------------------------------------------------------------
/// <summary>Converts a string to an HTML-encoded string.</summary>
public static String UrlEncode (this String value)
{
if (StringUtil.IsEmpty(value)) return value;
return WebUtility.UrlEncode(value);
}
/// <summary>Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.</summary>
public static String UrlDecode (this String value)
{
if (StringUtil.IsEmpty(value)) return value;
return WebUtility.UrlDecode(value);
}
//-------------------------------------------------------------------
}
}