General discussion

Locked

ASP.NET Authuntication & Authorization

By adityachs ·
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

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by jbblair In reply to ASP.NET Authuntication & ...

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.

Collapse -

by n3bu1a In reply to ASP.NET Authuntication & ...

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.

Collapse -

by adityachs In reply to

It is giving the following error

Collapse -

by adityachs In reply to ASP.NET Authuntication & ...

I tried to do so.But its giving errors
wat i did is :
in main web.config.
<authentication mode="Forms" />
<authorization>
<allow users="*" />
</authorization>

in the seconf web.config(created in a subfolder)
<authentication mode="Froms" />
<authorization>
<allow users="csa" />
<deny users="?" />
</authorization>

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

Collapse -

by adityachs In reply to

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: <authentication mode="Froms" />
Line 40:
Line 41:


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

Collapse -

by adityachs In reply to

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 :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<authorization>
<allow users="Satya"/>
<deny users="*" />
</authorization>
</system.web>
</configuration>

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.

Collapse -

by adityachs In reply to ASP.NET Authuntication & ...

This question was closed by the author

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums