473,785 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebClient.Downl oadFile() and WebRequest.Crea te() 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.c om/", "MSFT.htm") ;

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

at System.Net.WebR equest.get_Pref ixList()
at System.Net.WebR equest.Create(U ri requestUri, Boolean useUriBase)
at System.Net.WebR equest.Create(U ri requestUri)
at System.Net.WebC lient.GetWebReq uest(Uri address)
at System.Net.WebC lient.DownloadF ile(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.Crea te() I get a
NullReferenceEx ception with a stack trace that ends exactly the same way:

at System.Net.WebR equest.get_Pref ixList()
at System.Net.WebR equest.Create(U ri requestUri, Boolean useUriBase)
at System.Net.WebR equest.Create(U ri 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 4779
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.framewor k 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
942
by: ptass | last post by:
Hi I've installed win2k3 sp1 on a machine where an openRead on any given file was previously working. After installation, I get a webException as follows... ..message "An exception occurred during a webclient request" .._Hresult = "-2146233079" .._COMPlusExceptionCode ="-532459699" Sorry I don't have the whole error, but this seems to be the only pertinent
1
2421
by: Dave | last post by:
To open needed site I have to give my ID and a password. I can use webclient.downloadFile() to load an html text. Is there a way to display this site using an webclient object before calling downloadFile()? Thanks, Dave.
6
13304
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
3
7590
by: Manuel | last post by:
I have an asp page ("test.asp") that presents the data it receives from a post.When I try the following code, test.asp doesn't return the values (supposedly) posted to it. If I make a web page with a form and the values, test.asp reports them fine. ---------------------------- Dim thePost As String = "Variable1=Value1&Variable2=Value2&Variable3=Value3" Dim thePage As Byte() Dim MyWebClient As New System.Net.WebClient
8
9025
by: DEWright_CA | last post by:
Why does WebClient.DownloadFile loose my completed path? Ok, I have a function in my app then when my button is clicked it checks to see if the files come from a local drive or a http address. The portion of the code that pulls from the drive works great, but when the http address is active it changes the originating path to my C:\Windows\System32 folder instead of the proper path. I keep the path as a field on my form so I am certain...
1
6293
by: vin.dor | last post by:
Dear All, I am using WebClient in my Visual Studio .Net 2003 project to download an image from the Internet. The following is my function: C# Code: public static bool downloadFile(string URL, ref string fileName) { bool result = true;
2
2020
by: Deepson Thomas | last post by:
Hi, Iam trying to use WebClient class under system.net namespace to download files from internet via http. For that iam using DownloadFile method. But when ever iam trying to download any file iam getting the error “"The underlying connection was closed: Unable to connect to the remote server”. My computer is behind proxy. If iam trying to open this image via browser then it is working. I am pasting my code below.
1
1471
by: Deepson Thomas | last post by:
Hi, Iam trying to use WebClient class under system.net namespace to download files from internet via http. For that iam using DownloadFile method. But when ever iam trying to download any file iam getting the error “"The underlying connection was closed: Unable to connect to the remote server”. My computer is behind proxy. If iam trying to open this image via browser then it is working. I am pasting my code below.
1
12504
by: Mike | last post by:
I am using PowerShell to download an XML file into a string using the DownloadString(URI) method of System.Net.WebClient object. Sample commands below: $Result = $Null; $WebClient = new-object System.Net.WebClient; $WebClient.Encoding = ::Default; $WebClient.Proxy = ::DefaultWebProxy; $WebClient.Proxy.Credentials = ::DefaultCredentials;
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7502
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
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 we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.