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

Web.config security for non-aspx files

Hi,
We are developing a file repository, and we are using Forms authentication
security.
We dynamically create the Web.config files in each directory and it works
perfectly for aspx files, but it doesnt work for any other file (.zip, .jpg,
..doc, etc) it allows anyone to access them.

For example, a Web.config in a directory is:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>

But still allows anyone to access all the files in the directory.

Please help,

Gustavo
Nov 18 '05 #1
3 1532
Hi,
For such non-ASP.NET resource requests, you should let ASP.NET ISAPI handle
those requests.
The steps do to this are detailed @
http://www.dotnetjunkies.com/Article...4B6D130C7.dcik

HTH.

"Gustavo De la Espriella" <qq@qqq.qq.qq> wrote in message
news:Op**************@TK2MSFTNGP12.phx.gbl...
Hi,
We are developing a file repository, and we are using Forms authentication
security.
We dynamically create the Web.config files in each directory and it works
perfectly for aspx files, but it doesnt work for any other file (.zip, .jpg,
..doc, etc) it allows anyone to access them.

For example, a Web.config in a directory is:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>

But still allows anyone to access all the files in the directory.

Please help,

Gustavo

Nov 18 '05 #2
asp.net can handle only files IIS delegate it to handle.
For each file extention .aspx, .asax, .asmx, etc. there is a record in
settings in IIS that redirects query to certain handler.
You have to add your extention to be handled by asp.net framework, and
than asp.net will be able handle it.

Gustavo De la Espriella wrote:
Hi,
We are developing a file repository, and we are using Forms authentication
security.
We dynamically create the Web.config files in each directory and it works
perfectly for aspx files, but it doesnt work for any other file (.zip, .jpg,
.doc, etc) it allows anyone to access them.

For example, a Web.config in a directory is:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>

But still allows anyone to access all the files in the directory.

Please help,

Gustavo

Nov 18 '05 #3
In addition to the fine suggestions given so far, you could also store the
files in a database or in a private folder and dish them out via your own
code.

Here's more info:
http://msdn.microsoft.com/library/de...efiletopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Gustavo De la Espriella" <qq@qqq.qq.qq> wrote in message
news:Op**************@TK2MSFTNGP12.phx.gbl...
Hi,
We are developing a file repository, and we are using Forms authentication
security.
We dynamically create the Web.config files in each directory and it works
perfectly for aspx files, but it doesnt work for any other file (.zip,
.jpg,
.doc, etc) it allows anyone to access them.

For example, a Web.config in a directory is:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors mode="Off" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>

But still allows anyone to access all the files in the directory.

Please help,

Gustavo

Nov 18 '05 #4

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

Similar topics

0
by: Ant Corrie | last post by:
I am at a loss as to why this is not working. I am trying to setup a TextWriterTraceListener in my application config file and then execute the app from the network. I get a security exception...
4
by: Charlie | last post by:
Hi: I'm storing my dB connection in web.config file. Since it will be easily read by opening file, what is a good way to secure it? Thanks, Charlie
3
by: Wm. Scott Miller | last post by:
What is the difference between using a username and password in the processmodel section vs using one in impersonation in the machine.config file? What are the advantages of each and what are the...
1
by: savajx1 | last post by:
I am using the new "web deployment addin" in VS 2005 to output my web site. The web site is correctly output (assemblies generated in the \bin subdirectory). The web site on my developement...
8
by: theWizard1 | last post by:
Using Asp.NET 1.1, and C#. I have a directory for the website, and a directory under it named Secure. I have a web.config in each of the above directories. The web.config in the Secure...
0
by: df | last post by:
I'm seeing a strange problem in the Web App config tool: After creating a role and a user, going back to the Security tab home page, I get a "Specified cast is not valid" error. I've set up my...
3
by: wizofaus | last post by:
I've now created the same setup on four different machines, where I'm changing the processModel section machine.config so that ASP.NET (1.1) runs as SYSTEM, to give it permission to do various...
1
by: Ryan | last post by:
I am trying to log events to SQL Server instead of the computers event log, but, although I get no errors, I have no luck. The webevents_events table is empty. I have a custom event that I am...
3
by: Blasting Cap | last post by:
I am working on a web app that I want to be able to use a separate config file on, in addition to the web.config file that's already working in the application. If I put the following in the...
2
by: Vincent | last post by:
Hi, When the application doesn't use Roles, this configuration (web.config) works: <configuration> <connectionStrings> <clear/> <add name="myconn" connectionString="Data...
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
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...
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...
0
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
tracyyun
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...
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,...

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.