473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sending non-encoded URL with HttpWebRequest

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:%5c" 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
Jul 21 '05 #1
2 2321
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.

"Carl Gilbert" <cn*@newsgroup.nospam> wrote in message
news:OV****************@TK2MSFTNGP12.phx.gbl...
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:%5c" 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

Jul 21 '05 #2
Cheers,

The "UserEscaped"-toggle on the Uri-constructor did it!

myHttpWebRequest = HttpWebRequest.Create(New Uri( _

"http://10.0.1.1/axis-cgi/io/output.cgi?action=1:\",
True))

Thanx

"Marina" <so*****@nospam.com> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
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.

"Carl Gilbert" <cn*@newsgroup.nospam> wrote in message
news:OV****************@TK2MSFTNGP12.phx.gbl...
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:%5c" 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


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tim Black | last post by:
My application requires sending a large piece (~2MB) of data to several devices on a network via TCP sockets. I have experimented with different methods for doing this and this has raised some...
3
by: Robert A. van Ginkel | last post by:
Hello Fellow Developer, I use the System.Net.Sockets to send/receive data (no tcpclient/tcplistener), I made a receivethread in my wrapper, the receivethread loops/sleeps while waiting for data...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
8
by: Mike Owen | last post by:
Hi, I am using the following code to send email on a Windows 2003 Web Server: Imports System.Net.Mail ........ Dim msgmail As New MailMessage msgmail.To.Add(New...
15
by: colin | last post by:
Hi, Im familiar with c,c++ etc, and Ive spent a week trying to write my first app in c# it works reasonably well, but im having difficulty getting to grips with inter thread signalling etc. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.