473,396 Members | 1,767 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,396 software developers and data experts.

Strange Behavior in WebRequest.Create("...") and System.Uri("...")

Hi.

I've noticed, after moving some of our code to 2.0, that
System.Net.WebRequest.Create(System.String) and
System.Uri(System.String) no longer behave as they did in 1.1
framework.

Example:

string emailHttpPath =
"http://myexchange.mydomain.com/exchange/mymailboxalias/inbox/mysubfolder./;

// Notice the punctutation in the end, which is a legal web folder
name.

HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(emailHttpPath);

// Do stuff with the webrequest...

// This fails with a 404 error in 2.0 framework, but succeeds in 1.1
framework
HttpWebResponse webResponse =
(HttpWebResponse)webRequest.GetResponse();

The reason the above code fails, is that when
WebRequest.Create(System.String) is called, it removes the punctuation
from the httpPath making it look like this:
http://myexchange.mydomain.com/excha...x/mysubfolder/
WITHOUT the punctuation.
The url without the trailing punctuation correctly doesn't exist, so
the error it self is perfectly correct. However, I can't see how the
parsing of the url can be correct.

The same thing also applies for the System.Uri class. I tried
instantiating a System.Uri object with the above string http path, and
it also removes the trailing punctuation. I'm guessing
WebRequest.Create(System.String) internally puts a System.Uri on top of
the string http path.

What to do here?
I found this information about changes in System.Uri:
http://msdn.microsoft.com/netframewo...ce.aspx#System

Which seems to suggest that System.Uri always escapes urls. In the
above case, it seems however, that it doesn't escape correctly.

Dec 15 '05 #1
0 1778

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

Similar topics

0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
11
by: Robert Lacoste | last post by:
Dear Access gurus, I was using since years Access 97, now under XP SP2, without any problem. However I've just reformatted my HD (viruses...), reinstalled XP SP2, and then I am no longer able to...
23
by: Ken Turkowski | last post by:
The construct (void*)(((long)ptr + 3) & ~3) worked well until now to enforce alignment of the pointer to long boundaries. However, now VC++ warns about it, undoubtedly to help things work on 64...
3
by: nick | last post by:
The program runs well on Local harddisk. But it always popup the exception if I run it on Netware mapping disk. After debugger say there is no source code on the exception. Also the following error...
1
by: Chris Magoun | last post by:
I suddenly received an unexpected error in my project. I have been working on this project for some time without this issue. Nothing has changed in the form that caused the exception. A little...
5
by: msigwald | last post by:
I'm trying to write a little C program to run under linux, which must gain root so it can then shutdown the computer. I can get the code to execute the su command via system("su"), but once su...
1
by: Mike Hofer | last post by:
I've got two statements in my code that are both generating weird, weird, weird messages: The first one was, Dim document As System.Xml.XmlDocument Dim navigator As...
8
by: Henrik | last post by:
Hi Is there any way to see what the System process is doing? We have developed an application running at a production site to measure and optimize the production. The application needs to be...
13
by: Jen | last post by:
One user of my application is experiencing an exception "input string not in correct format". But it makes no sense where it is occurring. It is occurring when a string from a textbox ("172") is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.