Discussion Locked

ASP.NET Authuntication & Authorization

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I would like to know how to add more than one web.config file to an ASP.NET APPLICATION/PROJECT.

I want this 'coz in my web site some pages need no authuntication and authorization.anonymous users are allowed access some pages.but they are restricted to view some pages which need to proper authuntication and authorization

7 replies

by jbblair

There are two ways achieve what you are looking to do. If you use Active Directory, use the System.DirectoryServices and System.Web.SessionState namespaces to create a custom class to handle the authentication. Or you can put the secured pages into a subfolder and add another Web.Config to that folder with the appropriate security settings.

by n3bu1a

Your overall site security is set up to run as Forms then, right? If that's the case then you need to partition your site with folders because web.config is allowed only one per one folder. After the site directory is "foldered up", add a new web.config where applicable and with the authorization tag in it. Set the allow users tag to the list of roles that you want.

by adityachs

I tried to do so.But its giving errors
wat i did is :
in main web.config.

in the seconf web.config(created in a subfolder)

but its giving following error..if u dont mind please send me sample example.

by adityachs

for got to post the error
Server Error in '/satya' Application.
-------------------------------------------------
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 37: by Microsoft that offers a single logon and core profile services for member sites.
Line 38: -->
Line 39:
Line 40:
Line 41:

Source File: c:\inetpub\wwwroot\satya\sec\web.config Line: 39

by adityachs

I chkd all points given by Mr.Phil Weber. But every thing is ok :confused:. Thats why i have taken these many days to reply,as I am not sure where is the error is. :SICK:

Now I got the solution :WAVE: .The solution is :

The thing is we should remove every thing from inner Web.Config except the above code.What I did is using VS IDE i added a web.config file ,in which there will be built in code given by IDE ,i simply edited the code and added my code.Which is the reason for error.Now after removing all unnesasary code I got the solution.

This discussion is closed to new replies.