473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Nov 21 '05 #1
2 5854
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

Nov 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


Nov 21 '05 #3

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

Similar topics

1
6916
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...
5
5659
by: Dan Williams | last post by:
Apologies for the cross-post but i thought i'd aim for the largest audience possible. I have a web site that users have to register to with their email address. The site then emails the user...
2
1627
by: Brett | last post by:
I have a client that wants to send HTML based email. Building and sending isn't a problem, but he wants to include a plain text link at the top of the email that will display if the user doesn't...
5
6741
by: Lars | last post by:
Why doesn't the W3C's HTML Validator recognize &euro; and what do I have to do to make my html-file valid?
3
4614
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
6806
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...
4
1443
by: Drygast | last post by:
I have a form that updates an accessdatabase, when I close the form I have put a question wheter to send the database to the intenet or not. Is it possible to automatically check if the database...
8
2477
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...
4
4056
by: davermcl | last post by:
Hi, I'm experiencing a problem when using the VB SendKeys method. I'm sending characters to a textbox in another application. It works fine when the Windows Input Languages on both apps are...
15
2290
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
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.