Invoke WebRequest正在解码我的url,但仅在PowerShell中解码(不是ISE)
当我在PowerShell中运行此命令时,ISE工作得非常好。当我在PowerShell中运行它时,它会解码URL。有人知道怎么避开这个吗Invoke WebRequest正在解码我的url,但仅在PowerShell中解码(不是ISE),powershell,Powershell,当我在PowerShell中运行此命令时,ISE工作得非常好。当我在PowerShell中运行它时,它会解码URL。有人知道怎么避开这个吗 调用webrequest-urihttps://machinename/DirectoryServices/list/c%3A%5Cinetpub -冗长的 ISE的结果是有效载荷成功。但在PowerShell中,我收到以下错误消息—请注意url中的c:\inetpub—不知何故,它已从编码版本转换为解码版本: VERBOSE: GET https://ma
调用webrequest-urihttps://machinename/DirectoryServices/list/c%3A%5Cinetpub -冗长的
ISE的结果是有效载荷成功。但在PowerShell中,我收到以下错误消息—请注意url中的c:\inetpub—不知何故,它已从编码版本转换为解码版本:
VERBOSE: GET https://machinename/DirectoryServices/list/c:/inetpub with 0-byte payload
invoke-webrequest : The remote server returned an error: (404) Not Found.
At line:1 char:1
+ invoke-webrequest -uri https://hmachinename/Director ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
在我的机器上,我看到来自ISE和Powershell的
invoke webrequest-uri的HTTP404错误https://example.org/c%3A%5Cinetpub -详细信息
-详细信息在它们中的编码方式不同(ps=>VERBOSE:GEThttps://example.org/c:\具有0字节负载的inetpub,ise=>VERBOSE:GEThttps://example.org/c:%5Cinetpub 使用0字节的有效负载,但如果运行Fiddler,您将看到它们都使用GET命中相同的urihttps://example.org/c%3A%5Cinetpub HTTP/1.1
。