<location> doesn't work when parent directory of path doesn't exist

Hi,

 I'm having a problem setting up web.config to challenge for authentication on some pages, but not others.

 Here is what I'm doing:

<configuration>

...
    <system.web>

...
        <authentication mode="Windows" />
        <authorization>
            <allow users="*"/>
        </authorization>

...
    </system.web>
    <location path="server/local" allowOverride="false">
        <system.web>
            <authorization>
                <deny users="?" />
            </authorization>
        </system.web>
    </location>
</configuration>

 I.e. i'd like to allow all users on all pages, except on all pages below the server/local directory, where I'd like IIS to challenge anonymous users for authentication. The odd thing is that this only seems to work if the parent directory of 'local', i.e. 'server' exists on disk.

The thing is, that I'm working with a custom IHttpHandler that generates pages dynamically, and uses the path to pages to decide which pages to create (not ideal, maybe, but it's something I haven't got control over). That is, neither the 'server' nor the 'local' directory exist on disk, and so pages are returned without challenge. I can create these directories manually, as a work around, but a proper solution would be nice. E.g. if new values are passed in the path i have to remember to create the corresponding directories.

So, my question is, am I doing something wrong, or is it a bug. Or is this how it's supposed to work, and if so, is there a work around?

 Cheers,

 Tilman
 

0
Tilman
3/17/2008 11:59:42 AM
asp.net.security 27051 articles. 1 followers. Follow

4 Replies
2186 Views

Similar Articles

[PageSpeed] 56
Get it on Google Play
Get it on Apple App Store

Hey,

location path="filepath" is only what works; location path doesn't work for folders.  You could put a separate web config file in that folder...


Brian

"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4).
0
bmains
3/17/2008 12:33:49 PM

Thanks for the reply. The problem is, I got the same results when specifying a file path, i.e. it works when the parent directory exists, but not when it doesn't. (I actually want to specify individual files, not folders. Just thought it would keep the example a but simpler.)

As mentioned above, the folders don't exist, so I can't put web.config files in them. That's why I was using the location element. 

0
Tilman
3/17/2008 12:53:20 PM

Hello,

I missed the part about dynamic pages; sorry about that.  Try specifying one of the dynamic pages, and change the authorization element with the update below:

 <location path="server/local/file.aspx" allowOverride="false">
        <system.web>
            <authorization>
                <deny users="?" />
                <allow users="*" />
            </authorization>
        </system.web>
    </location>


Brian

"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4).
0
bmains
3/17/2008 7:27:19 PM

 Hi again,

 I tried your suggestion, but I'm afraid the same is happening, i.e. it works when the parent directory (server/local) exists, but not otherwise.

Cheers,

 Tilman

 

0
Tilman
3/18/2008 8:32:22 AM
Reply:

Similar Artilces:

rdf bound tree
One suggested to put this bug here for discussion: in case one has these rdf-triples s1 -> a -> 1 s1 -> b -> 2 s2 -> a -> 2 s3 -> a -> 3 s4 -> a -> 4 s4 -> b -> 4 and a tree with triple ?uri -> a -> ?a and a binding ?uri -> b -> ?b one cannot sort by predicate b because for s2 and s3 there is no triple I believe the problem resides in nsXULTreeBuilder.cpp nsXULTreeBuilder::CompareMatches(nsTemplateMatch* aLeft, nsTemplateMatch* aRight) For further details see bug #305981: https://bugzilla.mozilla.org/show_bug.cgi?id=305...

Directory.Delete(path, true); doesn't work (.net 1.1) and admin can't delete
Hello all.  I have a web application that creates a user temp directory, copies files into that directory, manipulates those files, sends files to the user, and then calls Directory.Delete(path, true); to delete the temp directory and all of its contents.  The problem is that this doesn't work and the directory is still there after the method call and code execution is complete.  I also can't delete the directory manually even when logged in as an Administrator.  It says 'Cannot delete <path>: Access is denied.'.  I was under the impression that specifying 'tru...

superreview granted: [Bug 87513] about:<randomness> doesn't display a default page, if the about: topic doesn't exist. : [Attachment 195365] Simple fix
Darin Fisher <darin@meer.net> has granted Boris Zbarsky <bzbarsky@mit.edu>'s request for superreview: Bug 87513: about:<randomness> doesn't display a default page, if the about: topic doesn't exist. https://bugzilla.mozilla.org/show_bug.cgi?id=87513 Attachment 195365: Simple fix https://bugzilla.mozilla.org/attachment.cgi?id=195365&action=edit ------- Additional Comments from Darin Fisher <darin@meer.net> sr=darin ...

superreview requested: [Bug 87513] about:<randomness> doesn't display a default page, if the about: topic doesn't exist. : [Attachment 195365] Simple fix
Boris Zbarsky <bzbarsky@mit.edu> has asked Darin Fisher <darin@meer.net> for superreview: Bug 87513: about:<randomness> doesn't display a default page, if the about: topic doesn't exist. https://bugzilla.mozilla.org/show_bug.cgi?id=87513 Attachment 195365: Simple fix https://bugzilla.mozilla.org/attachment.cgi?id=195365&action=edit ...

Can't get the Web Controls to work.. The Build.Bat file doesn't work? HELP>> ARGGG>.
Hi.. I was wanting to use the IE Web Controls, the Tab Strip, etc, and play with it.. Since I have IIS 5, I thought I'd copy them there using the Read me.txt instructions and then copy to a dev server that I use at a web host.. Well, everything worked except the Build file doesn't build the Microsoft.UI.Webcontrols.DLL file? When I try to run it by double clicking on it, it runs really fast in  the DOS window, but I can't see what it says and it closes.. So I tried to do so manually and I received an error that the "cse.exe is not recognized as an internal or external command or batch...

Urgent: AutoCompleteExtender doesn't work/Updatepanel doesn't work
This is my code for the AutoCompleteExtender <asp:textbox id="txtQuickSearch" runat="server" CssClass="inputText" style="width:145px; "></asp:textbox> <atlas:AutoCompleteExtender runat="server" ID="acSearch"> <atlas:AutoCompleteProperties TargetControlID="txtQuickSearch" Enabled="True" ServicePath="http://localhost/Sony.BusinessSuite.Web.UI/AtlasServices/MasterData.asmx" ServiceMethod="GetAllModels" minimumprefixlength="2" /> </atlas:AutoCompleteExtender> When i start typing fiddler shows: # Result Host URL Body Caching Content-Type User-...

Spellchecker doesn't work: no error, just doesn't work
Hey all. This is only happening with one person. It's all GW7 no SP. has worked fine before. Anyway when they type along it doesn't catch that spelling and it doesn't fire up spell check before it's sent like it is checked off to do. It does nothing. It just sends it when you click send; no error, nothing. I did a rebuild, analyze/fix. I have it set at all levels for this user. any ideas Mark, well, I'd try a more recent client version first. GW7 was less than stellar before SP1. Uwe -- Novell Support Connection Volunteer SysOp Please don...

Freenx doesn't work, NX doesn't work with compiz. Questions
FreeNX just doesn't work. NX from nomachine installed well, but I guess that limits me to two logins? NX doesn't work with compiz, tho, at least from machines not running compiz. So no great surprise. :-) Is there any way to run startkde that disables compiz and uses kwin? Alternatively, hows the easiest way to handle alternative logins? I could link the two documents folders together, but then I'd have problems with file permissions. I'm just looking for ideas here, I could live with two logins. -- dougnc -------------------------------------------...

document.getelementbyid('<%txtboxid%>') doesn't work
i have a ascx page that has a gridview with a textbox only available when you are in edit mode. and another gridview down below that is not in edit mode. when i tried click on select on second gridview, it triggers the javascript function that i will pass the value into the textbox in gridview 1. however when it goes into the js function and gets to the point where it reads documnet.getElementById('<%txtboxid.ClientID%>').value; it pops up an error message saying that the txtbox is not declare. Does anyone know why this happen? Thanks.  http://forums.asp.net/p/1194696/20...

Same app in two application directories
Hi All, I'm developing an ASP.net app on my local machine.  I have had Visual Studio create an application directory under "Default Web Site", and I have also created an application directory myself via inetmgr (IIS7 on Vista).  The directory created by VS works perfectly, but the directory which I created manually doesn't - every page I load returns a "could not load type" error.  The exact same files exist in both directories (I literally copied them from my dev directory to the one I created), so I know it's not the source files themselves.&...

Custom Datagrid: Doesn't display and doesn't work
Hi all,Hope someone can share their experience! I am trying to make a custom datagrid, only in appearance for now. Results:1. On dragging the control from the VS toolbox: get a grey rectangle, not the table like look. 2. On running the Web page: no HTML.<code>Imports System.ComponentModelImports System.Web.UI.WebControlsImports System.Web.UI<DefaultProperty("Text"), ToolboxData("<{0}:custDG runat=server></{0}:custDG>")> Public Class custDG    Inherits DataGrid    Public Sub New()        Me.BorderColor = ...

'exists'? Why doesn't it work?
------_=_NextPart_001_01C31893.158D4106 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi everybody, I'm having a problem using the exists function. I have the following = code that takes a list of searchwords (@search) and searches texts = stored in a MySQL database and orders them by relevance. My idea was that records that contain more than one search word are = probably more relevant than others.=20 The search results (id, rank) are stored in a hash with id as key and = rank as the corresponding value. As it may be p...

The type '<class>' exists in both '<dll location>' and '<dll location 2>'
For some reason though it appears that one of my class files (_common.cs - in the App_Code directory) is being included in the WAP .dll file as well as when it compiles the App_Code at runtime.error CS0433: The type 'inlinehockey._common' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\25321638\9b5c4b00\assembly\dl3\3657f4e6\cd91aef5_4d5cc601\inlinehockey.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\25321638\9b5c4b00\App_Code.xad_ajc1.dll'  The error was not knowing what dll to use for the type w...

The type '<class>' exists in both '<dll location>' and '<dll location 2>'
Hi. Has anyone come across this problem upgrading VS2003 to VS2005:The type '<class>' exists in both '<dll location>' and '<dll location 2>' Thanks! Hi TinaFMills,   Did you finish the process of migrate project form 2003 to 2005?   The error message means duplicate class name in different locations. Such as aspx pages, user controls, custom controls and so on. Please load the solution in Visual Studio IDE try to find the duplicate class. Edit->File and Replace->Find In Files (look in entire solution)    Sincerely,Benson YuMicrosoft Online...

Web resources about - <location> doesn't work when parent directory of path doesn't exist - asp.net.security

Resources last updated: 1/17/2016 3:05:18 PM