473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Forms Authentication Question

Using FormsAuthentication I would like to protect to folders 1 for admin and
one for the clients, obviously clients who are authenticated can't have
access to the admin folder

Can anyone tell me what is the general approach to achieve that?

Thank you,
Samuel
Jun 7 '06 #1
5 946
On Wed, 7 Jun 2006 17:33:52 +0100, "Samuel Shulman"
<sa************@ntlworld.com> wrote:
Using FormsAuthentication I would like to protect to folders 1 for admin and
one for the clients, obviously clients who are authenticated can't have
access to the admin folder

Can anyone tell me what is the general approach to achieve that?

Thank you,
Samuel


you can allow access to directories by roles in the system.web section
of your web.config

The below would allow just the role "admin" into the directory
admindir/files.

<location path="admindir/files" >
<system.web>
<authorization >
<allow roles="admin"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

Good Luck
Peter Kellner
http://peterkellner.net
Jun 8 '06 #2
And how do I set the role of the user?

Thanks,
Samuel
"PeterKellner" <pk**********@73rdstreet.com> wrote in message
news:73********************************@4ax.com...
On Wed, 7 Jun 2006 17:33:52 +0100, "Samuel Shulman"
<sa************@ntlworld.com> wrote:
Using FormsAuthentication I would like to protect to folders 1 for admin
and
one for the clients, obviously clients who are authenticated can't have
access to the admin folder

Can anyone tell me what is the general approach to achieve that?

Thank you,
Samuel


you can allow access to directories by roles in the system.web section
of your web.config

The below would allow just the role "admin" into the directory
admindir/files.

<location path="admindir/files" >
<system.web>
<authorization >
<allow roles="admin"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

Good Luck
Peter Kellner
http://peterkellner.net

Jun 8 '06 #3
> And how do I set the role of the user?

Are you using ASP.NET 1.1 or 2.0?

-Brock
http://staff.develop.com/ballen
Jun 9 '06 #4
1.1

Thank you,
Samuel

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:b8************************@msnews.microsoft.c om...
And how do I set the role of the user?


Are you using ASP.NET 1.1 or 2.0?

-Brock
http://staff.develop.com/ballen

Jun 9 '06 #5
Ok, since you're using 1.1 you should handle the HttpApplication.AuthenticateRequest
event (in global.asax will work) and in there determine the roles for your
user and then assign a GenericPrincipal to HttpContext.Current.User that
is initialized with your roles.

This link goes into a lot more detail, including caching roles in the forms
authr cookie:

http://msdn.microsoft.com/library/de...SecNetHT04.asp

-Brock
http://staff.develop.com/ballen

1.1

Thank you,
Samuel
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:b8************************@msnews.microsoft.c om...
And how do I set the role of the user?

Are you using ASP.NET 1.1 or 2.0?

-Brock
http://staff.develop.com/ballen

Jun 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
3
by: Nick | last post by:
I am working a new application...well actually a series of applications for my company. They want internal users to be able to go to a site and everything regarding security is transparent,...
11
by: ElmoWatson | last post by:
I tried on the Security newgroup, as well as other places, and haven't gotten an answer yet - - I'm pulling my hair out over this one. I'm trying to get Forms Authentication working.....I can get...
1
by: Rob | last post by:
I have an ASP.NET application that uses forms-based authentication. A user wishes to be able to run multiple sessions of this application simultaneously from the user's client machine. The...
2
by: Eric | last post by:
I am trying to build an app where the stuff in the root directory is open to all, but anything under the Restricted directory requires you to login and I want to use Forms to do it. I'm having...
7
by: Justin | last post by:
I am trying to password protect a subdirectory using forms authentication. I am using the "Location" tag to specify the directory to be protected. The login.aspx page is in the root directory of...
5
by: V. Jenks | last post by:
Using forms authentication, can I control which pages and/or directories a user would have access to or is that only available with Windows authentication? Thanks!
18
by: Rippo | last post by:
Hi I am using role base forms authentication in asp.net and have come across a problem that I would like advice on. On a successful login a session variable is set to identify a user. This is...
4
by: Bjorn Sagbakken | last post by:
In a web-application with login creds (user, pwd), these are checked against a user table on a SQL server. On a positive validation I have saved the userID, name, custno and role-settings in a...
5
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.