Sending non-encoded URL with HttpWebRequest

  • Thread starter Thread starter Carl Gilbert
  • Start date Start date
C

Carl Gilbert

Hello!

How can I make a web request without getting the url encoded. I want to make
a request to a web server that takes "\" as part of the url but can't handle
"%5C" which would be the url encoded version.

I want to send the following:
"http://10.0.1.1/axis-cgi/io/output.cgi?action=1:\"

But I get: "http://10.0.1.1/axis-cgi/io/output.cgi?action=1:\" in the web
request.


I'm trying to use the code below.

' ***
Dim myHttpWebRequest As HttpWebRequest
Dim myURIBuilder As New UriBuilder
With myURIBuilder
.Scheme = "http"
.Host = "10.0.1.1"
.Port = 80
.Path = "/axis-cgi/io/output.cgi"
.Query = "action=1:\"
End With

myHttpWebRequest = HttpWebRequest.Create(myURIBuilder.Uri)

With myHttpWebRequest
.Accept = "*/*"
.Headers.Add("Accept-Language", "en-gb")
.Headers.Add("Accept-Encoding", "gzip, deflate")
.Credentials = GetNetworkCredential(_UserName, _Password)
.GetResponse()
End With
'***

Thanks
 
The Uri has a UserEscaped property which you should try setting. It also has
an overloaded constructor that lets you set this at constructor time.
 
Back
Top