Removing from URI Relative Path

前端 未结 4 559
一生所求
一生所求 2021-01-03 20:09

I am generating a relative path from 1 directory to another. If the OutputDirectoryName property is a directory containing spaces, the spaces are encoded using %20, rather t

相关标签:
4条回答
  • 2021-01-03 21:01

    Try looking at Server.UrlDecode: http://msdn.microsoft.com/en-us/library/6196h3wt.aspx

    The space character is not the only one that is encoded.

    0 讨论(0)
  • 2021-01-03 21:05
    string sRelativeFilePath = Uri.UnescapeDataString(new Uri(sAbsolutePath + "\\", false).MakeRelative(new Uri(filename)));
    
    0 讨论(0)
  • 2021-01-03 21:05

    Use HttpServerUtility.UrlDecode Method (String)

    0 讨论(0)
  • 2021-01-03 21:07

    You can use

    Uri.UnescapeDataString
    

    http://msdn.microsoft.com/en-us/library/system.uri.unescapedatastring.aspx

    0 讨论(0)
提交回复
热议问题