当前位置:硬件测评 > 如何对句点进行 URL 编码?

如何对句点进行 URL 编码?

  • 发布:2023-10-10 12:15

| 我需要对一些句点进行 URL 编码,因为我必须传递一些文档路径,如下所示
http://www.sychzs.cn/test.aspx?document=test.docx
所以 test.docx 导致我出现非法字符错误。所以我需要将其更改为
。 --> %2E
我尝试使用 Server.UrlEncode
 string b = Server.UrlEncode(\"http://www.sychzs.cn/test.aspx?document=test.docx\");
但是我明白
\"http%3a%2f%www.sychzs.cn%2ftest.aspx%3fdocument%3dtest.docx\"
那么我是否必须使用字符串替换并手动执行并用该代码替换所有句点? ​​

相关文章