简体   繁体   English

停止%20替换URL字符串中的空格

[英]stop %20 replacing spaces from the URL string

I am trying to display a URL in my sharepoint list programmatically and the filename has some spaces , so by default it is taking %20 . 我正在尝试以编程方式在共享点列表中显示URL,并且文件名包含一些空格,因此默认情况下它占用%20。 how can i stop this behaviour , how can i show original filename with the spaces . 我如何停止这种行为,如何显示带有空格的原始文件名。

using System.Net;

You can decode it as below: 您可以如下解码:

string yourFileNameinURL = "My%20Name";
string yourFileNameYouWant = WebUtility.UrlDecode(yourFileNameinURL);
Console.WriteLine(yourFileNameYouWant);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM