471,350 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

WebClient.DownloadFile() and WebRequest.Create() throwing exceptio

Hello--I just upgraded to Visual Studio .NET 2005 and suddenly, all my .NET
1.1 applications that accessed Web sites have broken. For example, this code:

WebClient wc = new WebClient();
wc.DownloadFile("http://www.microsoft.com/", "MSFT.htm");

.... throws a WebException on the second line. The WebException doesn't
specify a problem, but it has an InnerException of type
NullReferenceException with the following stack trace:

at System.Net.WebRequest.get_PrefixList()
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Net.WebClient.GetWebRequest(Uri address)
at System.Net.WebClient.DownloadFile(Uri address, String fileName)

The same thing happens if I go one level lower for the WebRequest /
WebResponse approach. As soon as I call WebRequest.Create() I get a
NullReferenceException with a stack trace that ends exactly the same way:

at System.Net.WebRequest.get_PrefixList()
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)

Does anyone have any idea what could be causing this? The URI and local
filename are valid, there is no proxy server involved, Internet access on
this machine is working just fine, and I'm logged on as an Administrator
(yeah, I know I shouldn't be, but ...).

Many thanks.
Jan 9 '06 #1
1 4534
I now realize that this was probably the wrong newsgroup to have posted my
question in.

Since I didn't receive any reply here in several days, I've re-posted the
question in the dotnet.framework group. However, if someone replies to THIS
message (not my original posting of January 8) I will supposedly be
notified--so I would still appreciate any responses, since I'm still stuck
with this problem.

I am beginning to suspect that my next step should be to test WININET.DLL on
my machine, either via P/Invoke or an unmanaged C++ test app, just to make
sure that it's configured and working properly.

Thanks to all for reading this.

Best regards,
David Satz
Jan 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dave | last post: by
3 posts views Thread by Manuel | last post: by
8 posts views Thread by DEWright_CA | last post: by
1 post views Thread by vin.dor | last post: by
2 posts views Thread by Deepson Thomas | last post: by
1 post views Thread by Deepson Thomas | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.