【发布时间】:2012-06-02 19:25:23
【问题描述】:
我无法找到正确的方法在 C# 中对字符串进行 URL 编码。我想要的是将字符串some string 编码为some%20code。使用HttpUtility.URLEncode();方法编码为some+string。
【问题讨论】:
-
这是正确的方法。
-
那么问题出在哪里?你应该使用 HttpUtility.URLEncode
-
那么,
string.Replace("+", "%20")有什么问题吗?