Forms Authentication for only one folder

F

Flyguy

I am using Forms Authentication on a website. I’d like to configure it to
allow anyone access to the entire site with the exception of one folder. In
that one folder I’d like to limit it to users with logins. How do I setup my
web.config file for this?
 
S

Steven Cheng [MSFT]

Hi Flyguy,

From your description, you're using ASP.NET with FormsAuthentication, and
you wonder how to configure an particular folder to have different
authorization setting as the main web application, correct?

Based on my experience, for specifc authorization(for a parituclar page or
sub folder) in ASP.NET web application, there are two means:

1. You can create an additional web.config file in that certain sub folder
and override the "<authorization>" setting in that sub web.config file

2. There is a <location> element in web.config file which can let you
specify customized settings(different from main setting) for a particular
path(a page or a folder). e.g.

========================
..............

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

<system.web>
// main setting here....
</system.web>

</configuration>
=========================

here are some web article and reference introduced these methods.

#HOW TO: Control Authorization Permissions in an ASP.NET Application
http://support.microsoft.com/kb/316871

#Form authentication and authorization in ASP.NET
http://www.codeproject.com/KB/web-security/FormAuthenticnAuthorizn.aspx

#location Element (ASP.NET Settings Schema)
http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.







--------------------
 
F

Flyguy

Thanks Steven I will try to put an additional web.config file within the dir
that I want to protect. Thanks for your help.
 
S

Steven Cheng [MSFT]

Thanks for your followup,

I'm glad the information helps.

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).


--------------------
From: =?Utf-8?B?Rmx5Z3V5?= <[email protected]>
References: <[email protected]>
Subject: RE: Forms Authentication for only one folder
Date: Wed, 25 Jun 2008 12:56:12 -0700
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top