By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

How to prevent double-slashes in URLs from being replaced?

P: n/a
Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as u can
see in this example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

..NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin
Oct 9 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a

"Benjamin Janecke" <Be*************@discussions.microsoft.comwrote in
message news:16**********************************@microsof t.com...
Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as u
can
see in this example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

.NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at
runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin
url = url.replace("//","////");

(maybe... er...)
Oct 9 '06 #2

P: n/a
doesnt work. .net replaces any number of slashes with one single slash.
"james" wrote:

url = url.replace("//","////");

(maybe... er...)
Oct 9 '06 #3

P: n/a
This has never happened to me.

If this was the case, no one would ever be able to call a web service.

What exactly is your code?

"Benjamin Janecke" <Be*************@discussions.microsoft.comwrote in
message news:16**********************************@microsof t.com...
Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as u
can
see in this example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

.NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at
runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin

Oct 9 '06 #4

P: n/a
Hi,

don't get me wrong. .NET does not replace the // of the "http://"-part of
the url. again, the example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

there is a double-slash in the middle of the url, which gets replaced with a
single slash. the double slash at the beginning of the url, after the
protocol name is not affected.

My code is as simple as that:

Service.BaanRequest b = new Service.BaanRequest();
b.Url = "http://172.16.0.74:18088//LM_SoapServices/BaanRequest";

when i then check the b.Url property in the debugger, i get the folowing
result:

http://172.16.0.74:18088/LM_SoapServices/BaanRequest

So its seems the double slash at the middle of the url was replaced
immediately after setting the property - even before calling any web method.
This also happens when I set the url using the app.config file (which is the
normal way to do this).

..NET just doesnt seem to allow for multiple slashes to occurr. I can even do
this:

b.Url =
"http://172.16.0.74:18088/////////////////LM_SoapServices/BaanRequest";

and get the same result.
"Marina Levit [MVP]" wrote:
This has never happened to me.

If this was the case, no one would ever be able to call a web service.

What exactly is your code?

"Benjamin Janecke" <Be*************@discussions.microsoft.comwrote in
message news:16**********************************@microsof t.com...
Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as u
can
see in this example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

.NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at
runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin


Oct 9 '06 #5

P: n/a
I see what you are saying. I don't know why it does that, could be a bug.

"Benjamin Janecke" <Be*************@discussions.microsoft.comwrote in
message news:CA**********************************@microsof t.com...
Hi,

don't get me wrong. .NET does not replace the // of the "http://"-part of
the url. again, the example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

there is a double-slash in the middle of the url, which gets replaced with
a
single slash. the double slash at the beginning of the url, after the
protocol name is not affected.

My code is as simple as that:

Service.BaanRequest b = new Service.BaanRequest();
b.Url = "http://172.16.0.74:18088//LM_SoapServices/BaanRequest";

when i then check the b.Url property in the debugger, i get the folowing
result:

http://172.16.0.74:18088/LM_SoapServices/BaanRequest

So its seems the double slash at the middle of the url was replaced
immediately after setting the property - even before calling any web
method.
This also happens when I set the url using the app.config file (which is
the
normal way to do this).

.NET just doesnt seem to allow for multiple slashes to occurr. I can even
do
this:

b.Url =
"http://172.16.0.74:18088/////////////////LM_SoapServices/BaanRequest";

and get the same result.
"Marina Levit [MVP]" wrote:
>This has never happened to me.

If this was the case, no one would ever be able to call a web service.

What exactly is your code?

"Benjamin Janecke" <Be*************@discussions.microsoft.comwrote in
message news:16**********************************@microsof t.com...
Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as
u
can
see in this example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

.NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at
runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use
multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin



Oct 9 '06 #6

P: n/a
I might disagree with whoever told you that is compliant.

per RFC 1630

" PATH

The rest of the URI follows the colon in a format depending on the
scheme. The path is interpreted in a manner dependent on the
protocol being used. However, when it contains slashes, these
must imply a hierarchical structure."

Since the slashes are implying a hierarchical structure is /foo//bar is
equivalent in the hierarchy to /foo/bar?

foo <nullbar
foo bar

I would say that if these are being looke at in a hierarchical fashio they
are actually equivalent. I cannot find anywhere in the spec directly
discussing this though. The only specific case discussed where this is not
the case in gopher where they are fairly explicit in saying that it is not a
hierarchical relationship even though it should be, they then go through an
example of a gopher URI using // which leads me to believe that the the
intent was to have the two cases be identical.
Cheers,

Greg Young
MVP - C# http://codebetter.com/blogs/gregyoung
"Benjamin Janecke" <Be*************@discussions.microsoft.comwrote in
message news:16**********************************@microsof t.com...
Hi,

I have to call a java-written soap webservice from a .NET client
application. Unfortunately, the URL contains of a double slash "//", as u
can
see in this example:

http://linux04.bla.blabla.com:18088/...anRequest.wsdl

.NET automatically replaces the "//" with a "/" and therefore the call
fails. Setting the "Url" property of the web service proxy class at
runtime
results in the same behavior.

As far as I was told, it is NOT against the the standard to use multiple
slahes in an URL. So is there any way to stop .NET from replacing them?

thanks in advance,
Benjamin

Oct 10 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.