System.Web.HttpUtility.UrlEncode 方法在 .net core 中用哪个替代?

愚者只看星不看答案 2016-12-08 02:11:15
System.Web.HttpUtility.UrlEncode("helloworld", System.Text.Encoding.GetEncoding(936))

这个接受两个参数的方法在.net core中用哪个方法替代,哪位朋友知道,多谢。
...全文
703 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 6 楼 starfd 的回复:
byte[] encodedValue不就是Encoding获取到的结果么,这一步自己写有难度?
引用 6 楼 starfd 的回复:
byte[] encodedValue不就是Encoding获取到的结果么,这一步自己写有难度?
感谢回复,你看成是解密了。
  • 打赏
  • 举报
回复
byte[] encodedValue不就是Encoding获取到的结果么,这一步自己写有难度?
  • 打赏
  • 举报
回复
引用 3 楼 shingoscar 的回复:
编码自己用Encoding的方法转换 https://docs.microsoft.com/en-us/dotnet/core/api/system.net.webutility#System_Net_WebUtility_UrlEncodeToBytes_System_Byte___System_Int32_System_Int32_
估计这个方法也不行,因为 System.Text.Encoding gb2312Encoding= System.Text.Encoding.GetEncoding(936); 这行代码居然报不支持的异常
  • 打赏
  • 举报
回复
引用 2 楼 starfd 的回复:
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[]); }
    }
}
感谢回复,我特意说了,是支持两个方法参数的,其中一个参数是指定要哪种编码
  • 打赏
  • 举报
回复
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[]); }
    }
}
  • 打赏
  • 举报
回复

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧