how to let the web.config in the sub-directory to NOT to inherited from Root's web.config.

Hi,all,
 
How to let the sub-directory to avoid the authentication control from Root's webconfig?
I heard that we can add a new web.config to the sub-directory. And then we can slove the problem.
 
Virtual directory is :http://localhost/main
 
 
My application used the Forms Authentication, then all files in every directory is controlled by the Forms Authentication. But now i want a sub-directory to avoid this. (user can access this directory directly, Needn't to Login.)
 
In my application, the user can access the http://localhost/main/reminder and needn't to authentication.
 
 
When I add the new web.config(cancel the forms authentication section), and when I access this URL(http://localhost/main/reminder), The following error shown:
*****************************************************
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
 
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
 
Source Error:
 

Line 38:            by Microsoft that offers a single logon and core profile services for member sites.
Line 39:     -->
Line 40:     <authentication mode="None">
Line 41:         <!--<forms name=".ASPXAUTH" loginUrl="Login.aspx" protection="All" timeout="80" path="/"/>-->
Line 42:  </authentication>
 
 
Source File: C:\Projects.Net\SalesChecking\Reminder_Update\web.config    Line: 40
******************************************

Can anyone give me some suggestion about it?
 
Any suggestion about this are appreciated. Thanks!
 
Benny Ng
0
miaomiaoga
10/13/2005 5:15:40 AM
asp.net.security 27051 articles. 1 followers. Follow

4 Replies
1006 Views

Similar Articles

[PageSpeed] 21

You are not allowed to use Authentication section any where but the Root of the Application Folder. To enable every one to access a sub folder you need to change your Authorization section and put following

allow users ="*"

Authorization is not cascaded unless there is no web.config in the sub folder then parents rights apply ...or you can use location tag to specify different authorization for particular sub folder


ASP.Net Tips & Tricks - Jawad's Blog
0
JawadKhan
10/13/2005 7:32:42 PM
Use <location> in web.config. Using it, you can set permission for each directory.
0
KhaingLay
10/14/2005 11:35:54 AM
Setting the Authentication Method for your Application can only be done in the Root Web.config file. Instead, include one section like below for each Folder/File when you need to handle access individually:

<?xml version="1.0"?>
<
configuration>

<system.web>
   ........
</system.web>
   <
location path="reminder">
      <
system.web
>
         <
authorization
>
            <
allow users="*"
/>
         
</authorization
>
      </
system.web
>
   </
location
>
</
configuration>


Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
10/15/2005 3:27:27 PM
Thank you for yours informations. Now the problem sloved. Used the "location" section. Then the problem can be runs smoothly.


Benny Ng
0
miaomiaoga
10/17/2005 10:53:03 AM
Reply:

Similar Artilces:

How do I merge web services' app.config with web app's web.config? Help!!
I have a web application project that uses a separate class library containing web service references (service layer). I want to be able to configure the web reference URLs dynamically and I know you can set this up by setting the URL behavior to  'Dynamic', etc, etc. The problem is VS2005 puts the URLs in the project's app.config file. When the class library becomes a DLL component, I have no way of accessing the app.config file.Is there a way to make the web reference project to look for the URLs in the web.config instead of its app.config? Or is there a way to merge this app.config w...

Isolating web.config from it's parent web.config
I need to run an application withing a sub-directory of another application. Basically, I need to install an old version of DNN as a subdirectory of a current DNN2 installation. I get a problem of conflicting web.configs. The subdirectory want to use it's parent directory's web.config file. I thought by making the subdirectory an "application" in IIS that it would use the web.config in it's own folder but instead, it is referenceing the web.config file from it's parent. Any thoughts or help would be appreciated. Thanks, Stef. Stef, Because of the hierarchical nat...

web.config file of root directoy interferes with the sub-application web.config.
Hello! I encountered a problems when I added new sub-application to my application,  with its own web.config, When I try to open page www.mypage.com/subapplication/ It reads the web.config of www.mypage.com and throws an exception (I think it tries to loadsome dlls from root-bin directory (exactly ATLAS files..)  <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/> - exception on this line ) But why it reads the web.config of root dir? What can I do to solve that problem? Thank you.Artashes This is the expected behavior. web.config are inher...

What is the way to let second level web.config inherit from default web.config directly?
I have a virtual directory on my site, it has nothing to do with other content of the site, I don't want it inherit settings from the sites' web.config, is there a way I can do that? thanks!...

running 2 web.configs in the same website 1 in /web.config and one in /swf/web.config
Im having issues doing this. and when i remove the authentication from the swf/web.config it still doesnt seem to be applying to the child website at all. Whats the proper way to set a child website? Thanks!!  The lower most web.config overrides all previous settings. So if you remove the section from the /swf/web.config whatever settings you have in the web.config in the next higher level will have an effect on the content of the child folder.So instead of removing a section, try giving appropriate settings in the /swf/web.config....

Can 'web.config' decare a root directory?
I'm coding a user control at the moment involving the use of an image.  The user control is located within a UserControl folder in my project.  Images are also in an Images folder.To link to the image I currently use src="Images/example.gif".  I would prefer to use src="../Images/example.gif" as it makes more sense to me to point to the root of my application.However '../' points to localhost rather than my application path.  Is there a way to declare my projects root so I can use the markup I prefer?This has had me thinking and I was wondering if it were possible.  ...

~/Web.config read from project root but written to ...\Common7\IDE\~\Web.config ??
 Hey all,I'm trying to edit my Web.config in runtime, but I get some weird behaviour. Probably something simple I couldn't find on the net. But I'm new to this, so bear with me.In my code I open the ~/Web.config file and it reads it from the rood of my project folder. When I try to save it to ~/Web.config, it writes it to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\~\Web.config instead.How can the same relative path point to 2 places? Read from here but write to there ?!? How do I solve this?Here is my sample code:Default.aspx<%@ Page Language="C#" ...

web.config in Root Web
   On my server (Windows 2003 Sever) my root web (C:\inetpub\wwwroot) is an Atlas enabled site.  Everything there works as it should.  However when I view a published subweb (c:\inetpub\wwwroot\subweb1) which is not Atlas enabled I get the following error: Could not load type 'Mcrosoft.Web.Services.ScriptModule'.  The error message indicates that the error is in the root web web.config, not the subweb web.config. My question is this; If my root is Atlas enabled must all my subwebs be also?  If not, how do I get around this error?  Thanks for any help...

Web.config
I created a folder called 'secure' and created an application for it in IIS. It works as I expected for files within that folder however sub-folders are not protected. It was my understanding that sub-folders automatically inherited permission settings from the parent web.config file. Is this true? Or do I have to create a web.config file and application for every sub-folder? I am using:<configuration> <system.web>  <authentication mode="Forms">  <forms name="secure" loginUrl="login.aspx" protection="All" timeout="30">    &...

Interop reads machine.config but not site's web.config
I created some server web controls, registered in the GAC, and stored their settings in the web.config in the root of the site.  To avoid having to maintain multiple copies of code for supporting an ASP/ASP.NET environment, I created an interop.  When I used the interop in ASP, it was unable to read the settings stored in the site's web.config; I had to move them to the machine.config.  Is there a way around this default bevahior? Any help would be much appreciated! Thanks!   meh...I figured it out. I just had to use OpenWebConfiguration and spec...

what's the difference in configing web.config with SQL Server and MSDE?
I always get mistakes alert. And how to install MS SQL Server 2000 to a windows server 2003, I encount incompatible problem.thanks...

Need to put this in a web.config file. Transfer a collection from app.config to web.config.
<!--<setting name="Groups" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <string>GL CA Corporate Data</string> <string>GL CONT Contractors</string> <string>GL IT SolutionDelivery</string> </ArrayOfString> </value> </setting>-->   I need to put this in the below web.config.<?xml version="1.0"?><!-- Note: As an alternative to hand editing this fi...

Merging my web.config.mylibrary with the web.config
I see multiples web.config files in the framework 2.0 folder.  There is a way to had a web.config.mylibrary file that contains part of the configuration section.For example, I want that the profile section to be in the web.config.mylibrary file and when the web site will be load, the two web.config will be merge.  Is it possible to such thing ? Hi Biz, It is possible to-do this using the configSource property on configuration section elements.  You could then store different configuration sections in different configuration files in a distributed way.Here is a MSD...

Typed DataSet's ConnectionString from site's Web.Config
Hi to all, how can we get from a Strong-Typed DataSet inside a Library Class the ConnectionString which is inside the site's web.config ?The connection string must be unique (one definition only in web.config).We'd like to avoid rewriting the same connection string for every library in their respective properties.settings.Thanks and Regards,Sergio  In a web application Library classes (DLLs) run in the same process as the main application and have access to the same configuration data as the main application.  So all you have to do is access the AppSetting or ConnectionS...

Web resources about - how to let the web.config in the sub-directory to NOT to inherited from Root's web.config. - asp.net.security

Should Your Blog be in a Sub-Directory, Sub-Domain or a Separate Web Domain
Should I put my blog in a sub-directory, a subdomain or on its own domain? For SEO purposes, none of these things really matter, so it’s more ...

Resources last updated: 1/3/2016 10:55:01 AM