Note that there are some explanatory texts on larger screens.

plurals
  1. POIIS 6 ignores Web.config authorization settings
    primarykey
    data
    text
    <p>Context:</p> <ul> <li>IIS 6 on Windows 2003 Server</li> <li>ASP.NET 3.5 sp1</li> <li>C# Web Application running from a virtual directory</li> </ul> <p>There are a few files that I would like not to serve. For example, there's a <code>hibernate.cfg.xml</code> in the root directory that should not be accessible. There are also log files in a logs directory. On the local development server (Visual Studio 2008) The NHibernate config file can be protected in a couple of ways through Web.config:</p> <pre><code>&lt;location path="hibernate.cfg.xml"&gt; &lt;system.web&gt; &lt;authorization&gt; &lt;deny users="?"/&gt; &lt;deny users="*"/&gt; &lt;/authorization&gt; &lt;/system.web&gt; &lt;/location&gt; </code></pre> <p>OR</p> <pre><code>&lt;httpHandlers&gt; ... &lt;add path="*.cfg.xml" verb="*" type="System.Web.HttpForbiddenHandler" /&gt; &lt;/httpHandlers&gt; </code></pre> <p>The logs in a different directory can be protected through another Web.config file:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;authorization&gt; &lt;deny users="*"/&gt; &lt;/authorization&gt; &lt;/system.web&gt; &lt;/configuration&gt; </code></pre> <p>None of these work when the application is compiled using aspnet_compiler.exe and deployed to an IIS 6 server. No errors in the logs. The files are readable to anyone. The application is compiled and installed using MSBuild as follows:</p> <pre><code>&lt;AspNetCompiler Force="true" Debug="true" PhysicalPath="$(DeploymentTempPath)\$(DeploymentAppName)" TargetPath="$(DeploymentPath)\$(DeploymentAppName)" VirtualPath="/$(DeploymentAppName)" /&gt; </code></pre> <p>How do I make IIS 6 respect the authorization rules in Web.config.</p> <p>Note: assume that I can't move these files outside of the deployment directory.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload