In an ASP.NET application I have to perform a file downloading task
from a web server not exposed to internet, ie
Internet Client-->MyServer-->SecureServer-->MyServer--> Internet Client
All works fine when I have to download a pdf or an image file but when I try
to access a zip file I obtain a 401 error ( unauthorized access )
The code I use is:
string uri = "http://SecureServer/TestSolution/Test.zip";
string fileName = "C:\\MyServer\\ClientFile.zip";
WebClient wc = new WebClient();
wc.Credentials = CredentialCache.DefaultCredentials;
wc.DownloadFile(weburi, fileName);
Any help would be appreciated,
Thanks in advance 4 1542
Thus wrote gianniab, In an ASP.NET application I have to perform a file downloading task from a web server not exposed to internet, ie Internet Client-->MyServer-->SecureServer-->MyServer--> Internet Client All works fine when I have to download a pdf or an image file but when I try to access a zip file I obtain a 401 error ( unauthorized access )
The code I use is:
string uri = "http://SecureServer/TestSolution/Test.zip"; string fileName = "C:\\MyServer\\ClientFile.zip";
WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; wc.DownloadFile(weburi, fileName);
How is that server secured? Is it in your Intranet or on the Internet?
Cheers,
--
Joerg Jooss ne********@joergjooss.de
The secure server is on the intranet, while the web server is exposed to
internet, but i have the same problem also in a simplified development
environment with the zip file in the same directory as the web application
"Joerg Jooss" wrote: Thus wrote gianniab,
In an ASP.NET application I have to perform a file downloading task from a web server not exposed to internet, ie Internet Client-->MyServer-->SecureServer-->MyServer--> Internet Client All works fine when I have to download a pdf or an image file but when I try to access a zip file I obtain a 401 error ( unauthorized access )
The code I use is:
string uri = "http://SecureServer/TestSolution/Test.zip"; string fileName = "C:\\MyServer\\ClientFile.zip";
WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; wc.DownloadFile(weburi, fileName);
How is that server secured? Is it in your Intranet or on the Internet?
Cheers, -- Joerg Jooss ne********@joergjooss.de
Thus wrote gianniab, The secure server is on the intranet, while the web server is exposed to internet, but i have the same problem also in a simplified development environment with the zip file in the same directory as the web application
OK. I was wondering whether passing CredentialCache.DefaultCredentials has
any effect here. Are you sure you must authenticate like that? Is there a
web application that controls access to these ZIP files?
If you can download these files with your browser, you might want to use
Fiddler to capture the HTTP traffic and compare your "coded" session with
an interactive session.
Cheers,
--
Joerg Jooss ne********@joergjooss.de
"Joerg Jooss" wrote: OK. I was wondering whether passing CredentialCache.DefaultCredentials has any effect here. Are you sure you must authenticate like that? Is there a web application that controls access to these ZIP files?
The point is that i don't have to authenticate at all, using the Credential
is an attempt due to the 401 error for the zip files(all works in the right
way with the same code with gif, jpg, tiff or pdf files ); in production i
have an aspx page with a button that calls an asp page on the secure server
the return the files as a stream... If you can download these files with your browser, you might want to use Fiddler to capture the HTTP traffic and compare your "coded" session with an interactive session.
ok, that's an idea
Thanks
Gianni Cheers, -- Joerg Jooss ne********@joergjooss.de This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Helen Abell |
last post by:
Hi,
I am trying to use a .Net WebClient object to read data
from a url, but I am getting the following error:
System.Net.HttpWebRequest.CheckFinalStatus()...
|
by: Sven Putze |
last post by:
my target:
I want to upload a file via HTTP Post and show the user a
progress bar
my 1st try:
I´ve used WebClient.UploadFile and WebClient.UploadData,
they work fine but I don't know any...
|
by: Max Gattringer |
last post by:
Hi,
I've got a little problem with the WebClient, I always get a failure while
debugging this code:
private void menuItem2_Click(object sender, System.EventArgs e)
{
NameValueCollection...
|
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...
|
by: pmz |
last post by:
Dear Group,
I'm currently developing a simple Windows application in C#, which is
supposed to upload images - through 'WebClient' - into remote
(FreeBSD/Apache/PHP) server.
What is...
|
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...
|
by: Dhananjay |
last post by:
hello everyone
I have a problem with xml and sql server 2k.
first thing i have a website named this->
http://en.infosites.org/info/keyword.
when i am entering a value for keyword like this ->...
|
by: jaffar.kazi |
last post by:
Hi All,
I have a .NET Winforms application that regularly posts to a PHP page.
Till a few days back this worked perfectly. However, now, on certain
machines, after the data is sent to the server,...
|
by: MichaelSchoeler |
last post by:
Hi,
I'm having problems with the WebClient class regarding UTF-8 encoded data.
When I access a specific webservice directly I can see the data arrives in corretly formatted UTF-8. But when I...
|
by: Svinja |
last post by:
Hi, i am using WebClient.UploadFile to upload a file on my web page, code:
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential(userName, pass);...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
| |