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

G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top