roadie/Roadie.Api.Services/HttpEncoder.cs

35 lines
808 B
C#
Raw Normal View History

2018-11-11 01:11:58 +00:00
using Microsoft.AspNetCore.WebUtilities;
using Roadie.Library.Encoding;
2019-06-30 22:14:36 +00:00
using System.Text;
2018-11-03 21:21:36 +00:00
using System.Web;
namespace Roadie.Api.Services
{
public class HttpEncoder : IHttpEncoder
{
2018-11-04 15:16:52 +00:00
public string HtmlEncode(string s)
{
return HttpUtility.HtmlEncode(s);
}
2018-11-03 21:21:36 +00:00
public string UrlDecode(string s)
{
return HttpUtility.UrlDecode(s);
}
public string UrlEncode(string s)
{
return HttpUtility.UrlEncode(s);
}
2018-11-11 01:11:58 +00:00
public string UrlEncodeBase64(byte[] input)
{
return WebEncoders.Base64UrlEncode(input);
}
public string UrlEncodeBase64(string input)
{
2019-06-30 22:14:36 +00:00
return WebEncoders.Base64UrlEncode(Encoding.ASCII.GetBytes(input));
2018-11-11 01:11:58 +00:00
}
2018-11-03 21:21:36 +00:00
}
}