473,378 Members | 1,360 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,378 software developers and data experts.

where to put files so they can't be served by IIS

Hi,

in my ASP.NET web app, I have some config and data files. For convenience, I
would like to keep them under the application root directory on the web
server, but I don't want IIS to be able to serve them up to a user directly.

In the J2EE world, I would just stick them underneath the WEB-INF directory,
because that's a special reserved area that can never be accessed by the
client. What's the best way of doing something like this with asp.net?

I don't really want to rely on diretory permissions or specific IIS settings
because that's the kind of thing that gets lost when you copy it from one
machine to another. The files underneath this area might have any old file
extensions.

TIA

Andy
Nov 18 '05 #1
3 1073
..config files are not servable by IIS no matter where they are. As for your
other files, the best way to do it is really to set the directory
permissions.
"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:eC**************@TK2MSFTNGP12.phx.gbl...
Hi,

in my ASP.NET web app, I have some config and data files. For convenience, I would like to keep them under the application root directory on the web
server, but I don't want IIS to be able to serve them up to a user directly.
In the J2EE world, I would just stick them underneath the WEB-INF directory, because that's a special reserved area that can never be accessed by the
client. What's the best way of doing something like this with asp.net?

I don't really want to rely on diretory permissions or specific IIS settings because that's the kind of thing that gets lost when you copy it from one
machine to another. The files underneath this area might have any old file
extensions.

TIA

Andy

Nov 18 '05 #2
One option is to use a common extension for your private files, and
map them to the HttpForbiddenHandler to prevent them from being
served.

i.e.

<add verb="*" path="*.private" type="System.Web.HttpForbiddenHandler"
/>

You'll also have to add them to the IIS script mappings.
ASP.NET already protects file types like .config.

There is some detailed documentation in the following KB article:

HOW TO: Use ASP.NET to Protect File Types
http://support.microsoft.com/default...b;EN-US;815152

Hope this helps!

--
Scott
http://www.OdeToCode.com

On Wed, 11 Aug 2004 17:38:52 +0100, "Andy Fish"
<aj****@blueyonder.co.uk> wrote:
Hi,

in my ASP.NET web app, I have some config and data files. For convenience, I
would like to keep them under the application root directory on the web
server, but I don't want IIS to be able to serve them up to a user directly.

In the J2EE world, I would just stick them underneath the WEB-INF directory,
because that's a special reserved area that can never be accessed by the
client. What's the best way of doing something like this with asp.net?

I don't really want to rely on diretory permissions or specific IIS settings
because that's the kind of thing that gets lost when you copy it from one
machine to another. The files underneath this area might have any old file
extensions.

TIA

Andy


Nov 18 '05 #3
I guess I could put a web.config file in the top level of my hidden
directory and put something in there to make sure nobody can access it via
IIS directly

maybe <authorization><deny users="*" />

"Scott M." <s-***@nospam.nospam> wrote in message
news:us**************@TK2MSFTNGP10.phx.gbl...
.config files are not servable by IIS no matter where they are. As for your other files, the best way to do it is really to set the directory
permissions.
"Andy Fish" <aj****@blueyonder.co.uk> wrote in message
news:eC**************@TK2MSFTNGP12.phx.gbl...
Hi,

in my ASP.NET web app, I have some config and data files. For convenience,
I
would like to keep them under the application root directory on the web
server, but I don't want IIS to be able to serve them up to a user

directly.

In the J2EE world, I would just stick them underneath the WEB-INF

directory,
because that's a special reserved area that can never be accessed by the
client. What's the best way of doing something like this with asp.net?

I don't really want to rely on diretory permissions or specific IIS

settings
because that's the kind of thing that gets lost when you copy it from

one machine to another. The files underneath this area might have any old file extensions.

TIA

Andy


Nov 18 '05 #4

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

Similar topics

1
by: Matt Walker | last post by:
I decided to flesh out my php skills by building a web application which could scan through local files on my intranet (specifically mapped drives on my server) and generate a list of Movies or...
3
by: Prash | last post by:
IIS serving javascript files, gives me error 4/21/2006 6:48 AM Guys/Gals, I am using IIS as a server to serve the javascript files. But it is giving me the error as "Object doesn't support this...
5
by: nick | last post by:
I need to create a simple asp.net application that use password protect some html pages. The html page provider doesn't know asp.net. And the host doesn't allow me to create user accounts. ...
2
by: John Austin | last post by:
I thought I would experiment for the first time with an Image standard control in VS 2005. I pressed create web site, I copied a jpg into the App_Data folder, added an image control to Default.aspx...
1
by: robert | last post by:
I am struggling with what I thought would be a very basic concept. I have a web application which I have migrated to .NET 2.0. Now I understand that there is no such thing as excluding files from...
2
by: martin.fowler | last post by:
Hi everyone, I dont know if this is the correct place for this question or not, but here it goes. I have multiple projects that I use the same code for. I wanted to know if it was possible to load...
4
by: | last post by:
I have learned about compartmentalizing my code base using Class Libraries. I have my common code such as my ORM framework broken out into their own Class Libraries, which are referenced as...
6
by: Homer J. Simpson | last post by:
Hi all, I have enough experience with HTML/classic ASP to get by, and I'm trying to learn ASP.NET. Traditionally, I've taken the habit of breaking out extra-long CSS files into multiple,...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.