I am using Webclient.downl oad to HTTP download a file from an IIS 6.0 server.
It works for all the files I have except for those type .config.
If I rename the files to .txt extension, it works.
I've added MIME types to support .config files as application/xml but I
still get the 403 error.
Is there a way other than renaming the file extension? 3 3836
This is due to the handler in web.config.
By default, .config gets a HttpForbiddenHa ndler (except for
..exe.config and .dll.config which get StaticFileHandl er - at least on
my setup).
I strongly suggest that you leave this alone; otherwise it allows
people to snoop at your configuration, which is not great, even if it
is encrypted (which many aren't).
If the file is actually the config for an app, either use the above (I
can't remember if this is default or custom), or use the ClickOnce
trick and add .deploy to the name, i.e. myapp.exe.deplo y,
myapp.exe.confi g.deploy - and strip it again after download.
If the config in question is in a sub-folder, you could add a
web.config, remove the existing .config handler and add a new one.
Standard web.config stuff. Let me know if you don't know how.
Marc
Marc,
Thanks, I was afraid of that. I was considering renaming the file and
download it but thought maybe there is a better way.. other than ClickOnce.
Thanks
"Marc Gravell" wrote:
This is due to the handler in web.config.
By default, .config gets a HttpForbiddenHa ndler (except for
..exe.config and .dll.config which get StaticFileHandl er - at least on
my setup).
I strongly suggest that you leave this alone; otherwise it allows
people to snoop at your configuration, which is not great, even if it
is encrypted (which many aren't).
If the file is actually the config for an app, either use the above (I
can't remember if this is default or custom), or use the ClickOnce
trick and add .deploy to the name, i.e. myapp.exe.deplo y,
myapp.exe.confi g.deploy - and strip it again after download.
If the config in question is in a sub-folder, you could add a
web.config, remove the existing .config handler and add a new one.
Standard web.config stuff. Let me know if you don't know how.
Marc
I'm not saying you have to use ClickOnce - just the same trick ;-p
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
by: Glen |
last post by:
I'm writing a console utility to download specific files from web sites
based on the command line options. In most cases, I can trap the 404
error when the file isn't available because the operator mistyped the
URL or it's offline for whatever reason. The problem I'm running into
is with certain sites where the admin has set up a redirect to handle
the 404 condition and redirects the request to another page.
In this case, the...
|
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");
|
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...
|
by: Jarod_24 |
last post by:
I have some problems with using Net.WebClient
This function of mine recieves an array with Urls, and Filenames, and is supposed to download all the files (binary files) that is
listed in the array, but in some cases it dosen't work. Normally it would download files (binary) to a folder, but on some occations
it will only download the first file in the array as a binary, and then the rest of the files downloaded will actually only contain...
| |
by: Dave Starman |
last post by:
Hello,
I am trying to download web data into my current application. Failing
many attempts I tried to run the sample from the MS Help files with no
luck. If I create a new solution and put the sample code on a button
then it works. However, when do the same on a new form in my existing
solution then I get following error. Could there be some global
settings in my application that are causing problems?
Thanks in advance,
|
by: Giovanni |
last post by:
Hi Guys,
Really strange problem I am experiencing... I have setup a virtual
directory with Read Only permissions on an ISA/IIS server (SBS 2003). In
that virt. dir., I placed 1 file (setup.exe). I then use
WebClient.DownloadFileAsync (.NET 2.0 Pro.) and all downloads well including
progress bar indicator, bytes received, etc... Here is the problem:
When I replace the file (setup.exe), with a different, larger file, it
still...
|
by: Jobs |
last post by:
Download the JAVA , .NET and SQL Server interview with answers
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
|
by: =?Utf-8?B?U2NvdHQgVHJpY2s=?= |
last post by:
I followed the instructions from MSDN for Webclient UploadFile and I get an
error: Could not find file 'C:\testfile.xls'.
If I add the file (c:\testfile.xls) to the server I do not get the error and
the file is copied from the server to the server, rather than from the web
client to the server.
Please help!!!
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |