473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Webclient.Download using .config file type generates 403 error

I am using Webclient.download 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?

Jul 18 '07 #1
3 3821
This is due to the handler in web.config.

By default, .config gets a HttpForbiddenHandler (except for
..exe.config and .dll.config which get StaticFileHandler - 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.deploy,
myapp.exe.config.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
Jul 19 '07 #2
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 HttpForbiddenHandler (except for
..exe.config and .dll.config which get StaticFileHandler - 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.deploy,
myapp.exe.config.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
Jul 19 '07 #3
I'm not saying you have to use ClickOnce - just the same trick ;-p

Marc
Jul 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
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...
9
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...
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 =...
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....
0
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...
6
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...
6
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...
2
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...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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...

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.