473,473 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

System.Net.WebClient.DownloadFile doesn't work with http attachments

1 New Member
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim A_URL As String = "http://reportserver.com:7403/xmlpserver/Guest/LB_DEV/RMS/Orders/ord_det/ord_det.xdo?_xpf=&_xpt=0&_xdo=%2FGuest%2FLB_DEV%2FRMS%2FOrders%2Ford_det%2Ford_det.xdo&_xmode=4&xdo%3Axdo%3A_paramsPM_order_no_div_input=500036&_paramsPM_order_no=500036&_xt=Purchase%20Order%20Report&_xf=pdf&_xautorun=false"
  3.             Dim B_SAVEAS As String = "C:\reports\xdo.pdf"
  4.  
  5.  
  6.  
  7.             Dim _WebClient As New System.Net.WebClient()
  8.             ' Downloads the resource with the specified URI to a local file.
  9.             _WebClient.Headers.Add(("Content-Type"), "pdf")
  10.  
  11.  
  12.             ' _WebClient.Headers["A_url"] = "pdf";
  13.  
  14.  
  15.             '_WebClient.Headers["ContentType"] = "pdf";
  16.  
  17.             _WebClient.DownloadFile(A_URL, B_SAVEAS)
  18.  
  19.  
Hi Team,

i am using the above code to download a pdf report generated in the attached link (url) i could see a file generated in the destination with the given name . However i am unable to open the newly saved file .

then i started using ..._WebClient.Headers.Add(("Content-Type"), "pdf")

even after i get same kind of error while opening the pdf report. i am trying to save whatever is there in the link . Link actually opens a PDF file , i want to save that copy in the server for reference. Let me know if you have any change that i need to make in my above code ?
i have got a smiliar link from bytes.com which is

http://bytes.com/topic/asp-net/answers/345837-system-net-webclient-downloadfile-doesnt-work-http-attachments

however its C# we are working in VB.

Any help will be great for me.

Best REgards
Jinson
May 19 '14 #1
0 1819

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: James Write | last post by:
Hi, I am using the webclient.downloadfile() method to download a file from a remote web server to the local harddrive. public CopyFile(string sSrcPath, string sDestPath) { WebClient oClient...
1
by: Sriram | last post by:
Hi. Following code works fine on XP, but not on W2K+SP4. When I run it on W2K, it does not give me any error, exception. I have tried setting StartInfo.ErrorDialog = True,...
6
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 =...
1
by: Cheri Elkin | last post by:
I recieve the following error when attempting to download a file from our web server to be placed on our hard drive. Any clues as to why I would get this error? By the way, the directory already...
8
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....
1
by: peter.rietmann | last post by:
I have been suddenly having a performance problem downloading images from one server (productive) to another (productive) using the following code .. WebClient webClient = new WebClient(); try...
2
by: Lila Godel | last post by:
I am having a problem with the download of web pages via the WebClient.DownloadFile function in the specialized VB.Net 2003 I.E. plug-in I am designing to speed up the work on my latest project. ...
1
by: David Satz | last post by:
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();...
3
by: Chip | last post by:
Hi, How do I add a required cookie to my WebClient.DownloadFile() request? Chip
8
by: =?Utf-8?B?UnVpIE9saXZlaXJh?= | last post by:
WebClient.DownloadFile I am using the WebClient.DownloadFile function to download a file from server to a local client. When I execute the below code, file is created in server and not in...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
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,...
1
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...
0
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...
0
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.