Program Club

System.Web.HttpUtility.UrlEncode / UrlDecode ASP.NET 5 대체

proclub 2020. 11. 14. 11:16
반응형

System.Web.HttpUtility.UrlEncode / UrlDecode ASP.NET 5 대체


System.Web.HttpUtility.UrlEncode및에 대한 대체가 있는지 알고 싶습니다 UrlDecode.

내가 찾은대로 Encode: Microsoft.Framework.WebEncoders.UrlEncoder.Default.UrlEncode.

그러나 나는 찾지 못했습니다 UrlDecode. 하나있어?


System.Runtime.ExtensionsUrlDecodeHtmlDecode.

namespace System.Net
{
    public static partial class WebUtility
    {
        public static string HtmlDecode(string value) { return default(string); }
        public static string HtmlEncode(string value) { return default(string); }
        public static string UrlDecode(string encodedValue) { return default(string); }
        public static byte[] UrlDecodeToBytes(byte[] encodedValue, int offset, int count) { return default(byte[]); }
        public static string UrlEncode(string value) { return default(string); }
        public static byte[] UrlEncodeToBytes(byte[] value, int offset, int count) { return default(byte[]); }
    }
}

최신 정보

System.Runtime.Extensions확장을 정의하는 동안 코드에서 알 수 있듯이 호출해야하는 실제 클래스는System.Net.WebUtility

옵션 1 : System.Net.WebUtility

현재 더 공개적으로 포함 할 계획이 이루어지지 Decode에를 Microsoft.Framework.WebEncoders.

용법

System.Net.WebUtility.UrlEncode(myString)
System.Net.WebUtility.UrlDecode(myString)

옵션 2 : System.Text.Encodings.Web.UrlEncoder

이것은 asp.net 핵심 서비스 컨테이너에 등록되며 컨트롤러 등에 주입 할 수 있습니다.

참고 URL : https://stackoverflow.com/questions/32434401/replacement-for-system-web-httputility-urlencode-urldecode-asp-net-5

반응형