473,399 Members | 2,146 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,399 software developers and data experts.

Directory based authentication

Hello all,

I have a set of admin pages which are put in a subfolder called admin inside
my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page
within the admin subfolder is accessed for the first time, an authentication
window pops up asking for username-password. How can I implement the same
in IIS ?

This way I can avoid having to programmatically implement login feature.

Can anyone please throw light on this ?

Thanks
SeeSharp.
Nov 17 '05 #1
10 3573
You can go for form authentication or windows authentication, then use
location tag or create web.config (in that folder) to specify particular
permission for specific folder using role based authorization. For example
to set permission to particular folder using location tag,
<location path="<foldername>">
<system.web>
<autorization>
<allow users="Admin">
<deny users="*">
</autorization>
</system.web>
</location>
--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"See Sharp" <sm****@inapp.com> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hello all,

I have a set of admin pages which are put in a subfolder called admin inside my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page
within the admin subfolder is accessed for the first time, an authentication window pops up asking for username-password. How can I implement the same
in IIS ?

This way I can avoid having to programmatically implement login feature.

Can anyone please throw light on this ?

Thanks
SeeSharp.

Nov 17 '05 #2
Thanks Saravana,

But I still get problems. Its shows an access denied problem.
I have a parent directory called app. I configured it as a virtual
directory.
I use the IIS configuration tool from control panel, right click app -> all
tasks -> permission wizard -> select new security settings -> public
website.
Now I can access the pages in app folder as http://localhost/app/index1.aspx
In the web.config of the app folder I have the following data:
************************************************** ********
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>

<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Windows" />
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
<location path="admin">
<system.web>
<authorization>
<allow users="abcd" />
<deny users="*" />
</authorization>
</system.web>
</location>
</configuration>
****************************

I have a subfolder admin in my app folder.
Actually I made it as another application and copied the application's
folder as a subfolder called admin in my app folder.
The admin folder therefore has a web.config too.
But I deleted it so that there is no ambiguity.
I have not made the admin subfolder as a virtual directory.

Now with the above security settings, I should get the the files in the
admin folder as http://localhost/app/admin/index1.aspx
It should ask for authentication and when I enter the username password of
user abcd, it should let me in.
But This does not happen.
I get an error.
I tried making the admin subfolder as a virtual directory.
I even tried to retain its web.config and place this within it:
<authorization>
<allow users="abcd" />
<deny users="*" />
</authorization>
In that case it works, but it allows all users in.
Not abcd alone.

Can you please throw light on this ?
Thanks a lot
SeeSharp.

"Saravana" <sa******@sct.co.in> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
You can go for form authentication or windows authentication, then use
location tag or create web.config (in that folder) to specify particular
permission for specific folder using role based authorization. For example
to set permission to particular folder using location tag,
<location path="<foldername>">
<system.web>
<autorization>
<allow users="Admin">
<deny users="*">
</autorization>
</system.web>
</location>
--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"See Sharp" <sm****@inapp.com> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hello all,

I have a set of admin pages which are put in a subfolder called admin

inside
my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page
within the admin subfolder is accessed for the first time, an

authentication
window pops up asking for username-password. How can I implement the same in IIS ?

This way I can avoid having to programmatically implement login feature.

Can anyone please throw light on this ?

Thanks
SeeSharp.


Nov 17 '05 #3
Have set integrated authentication or basic authentication in IIS. So first
set its authentication mode in IIS,then enable impersonation in web.config.
Then try, it should work.

--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"See Sharp" <sm****@inapp.com> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
Thanks Saravana,

But I still get problems. Its shows an access denied problem.
I have a parent directory called app. I configured it as a virtual
directory.
I use the IIS configuration tool from control panel, right click app -> all tasks -> permission wizard -> select new security settings -> public
website.
Now I can access the pages in app folder as http://localhost/app/index1.aspx In the web.config of the app folder I have the following data:
************************************************** ********
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>

<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Windows" />
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
<location path="admin">
<system.web>
<authorization>
<allow users="abcd" />
<deny users="*" />
</authorization>
</system.web>
</location>
</configuration>
****************************

I have a subfolder admin in my app folder.
Actually I made it as another application and copied the application's
folder as a subfolder called admin in my app folder.
The admin folder therefore has a web.config too.
But I deleted it so that there is no ambiguity.
I have not made the admin subfolder as a virtual directory.

Now with the above security settings, I should get the the files in the
admin folder as http://localhost/app/admin/index1.aspx
It should ask for authentication and when I enter the username password of
user abcd, it should let me in.
But This does not happen.
I get an error.
I tried making the admin subfolder as a virtual directory.
I even tried to retain its web.config and place this within it:
<authorization>
<allow users="abcd" />
<deny users="*" />
</authorization>
In that case it works, but it allows all users in.
Not abcd alone.

Can you please throw light on this ?
Thanks a lot
SeeSharp.

"Saravana" <sa******@sct.co.in> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
You can go for form authentication or windows authentication, then use
location tag or create web.config (in that folder) to specify particular
permission for specific folder using role based authorization. For example to set permission to particular folder using location tag,
<location path="<foldername>">
<system.web>
<autorization>
<allow users="Admin">
<deny users="*">
</autorization>
</system.web>
</location>
--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"See Sharp" <sm****@inapp.com> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hello all,

I have a set of admin pages which are put in a subfolder called admin

inside
my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page within the admin subfolder is accessed for the first time, an

authentication
window pops up asking for username-password. How can I implement the

same in IIS ?

This way I can avoid having to programmatically implement login feature.
Can anyone please throw light on this ?

Thanks
SeeSharp.



Nov 17 '05 #4
Please fix the date on your computer.
Nov 17 '05 #5
Yup. I did that. I am sorry. I used the calendar to choose a relieving date
[ I am planning to resign from my job next month].
And I accidently clicked OK :">

SeeSharp

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:ug**************@TK2MSFTNGP12.phx.gbl...
Please fix the date on your computer.

Nov 17 '05 #6
Hi SeeSharp,

I am an application that does EXACTLY the same as you - an admin folder with
admin pages that is restricted to a select few. Have you managed to get
your application to work as you wanted? If so, I would be very interested
to know how you did it. Authentication is something I have not yet
mastered.

Cheers,

Paul Hobbs

"See Sharp" <sm****@inapp.com> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hello all,

I have a set of admin pages which are put in a subfolder called admin inside my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page
within the admin subfolder is accessed for the first time, an authentication window pops up asking for username-password. How can I implement the same
in IIS ?

This way I can avoid having to programmatically implement login feature.

Can anyone please throw light on this ?

Thanks
SeeSharp.

Nov 17 '05 #7
Hi Paul

I disabled anonymous logon to my admin directory. In the access control
list, I add each member whom I want to deny [including anonymous] and deny
all rights to them. The everyone user has all "required" permissions.

SeeSharp

"Paul Hobbs" <pa**@mobius.net.au> wrote in message
news:#R**************@TK2MSFTNGP12.phx.gbl...
Hi SeeSharp,

I am an application that does EXACTLY the same as you - an admin folder with admin pages that is restricted to a select few. Have you managed to get
your application to work as you wanted? If so, I would be very interested
to know how you did it. Authentication is something I have not yet
mastered.

Cheers,

Paul Hobbs

"See Sharp" <sm****@inapp.com> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hello all,

I have a set of admin pages which are put in a subfolder called admin

inside
my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page
within the admin subfolder is accessed for the first time, an

authentication
window pops up asking for username-password. How can I implement the same in IIS ?

This way I can avoid having to programmatically implement login feature.

Can anyone please throw light on this ?

Thanks
SeeSharp.


Nov 17 '05 #8
AuthentiX passwords protects directories and files.

http://www.flicks.com/prod.htm#authnx


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #9
What sets the current "user"? For example how do I know if the person is
"Admin"? Where is that set?

"Saravana" <sa******@sct.co.in> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
You can go for form authentication or windows authentication, then use
location tag or create web.config (in that folder) to specify particular
permission for specific folder using role based authorization. For example
to set permission to particular folder using location tag,
<location path="<foldername>">
<system.web>
<autorization>
<allow users="Admin">
<deny users="*">
</autorization>
</system.web>
</location>
--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"See Sharp" <sm****@inapp.com> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hello all,

I have a set of admin pages which are put in a subfolder called admin

inside
my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page
within the admin subfolder is accessed for the first time, an

authentication
window pops up asking for username-password. How can I implement the same in IIS ?

This way I can avoid having to programmatically implement login feature.

Can anyone please throw light on this ?

Thanks
SeeSharp.


Nov 17 '05 #10
You assign roles to each user. This has to be done on each request. You set
Context.User to a new GenericPrincipal, and assign roles at the same time.
Then you can check using User.IsInRole.

The downside is, obviousely, that you must create a new user on each
request. A better way would be to save all this information in the Session
object. But unfortunately that data isn't accessible from within any of the
Application_Request* events in global.asax. So you basically need to include
a file for checking in every page.

/john

"VB Programmer" <gr*********@go-intech.com> wrote in message
news:uy**************@TK2MSFTNGP11.phx.gbl...
What sets the current "user"? For example how do I know if the person is
"Admin"? Where is that set?

"Saravana" <sa******@sct.co.in> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
You can go for form authentication or windows authentication, then use
location tag or create web.config (in that folder) to specify particular
permission for specific folder using role based authorization. For example to set permission to particular folder using location tag,
<location path="<foldername>">
<system.web>
<autorization>
<allow users="Admin">
<deny users="*">
</autorization>
</system.web>
</location>
--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"See Sharp" <sm****@inapp.com> wrote in message
news:#U**************@TK2MSFTNGP11.phx.gbl...
Hello all,

I have a set of admin pages which are put in a subfolder called admin

inside
my application folder.
I want to limit access to these admin pages.
How can I do this?

In Linux, I can password protect the directory, so that whenever a page within the admin subfolder is accessed for the first time, an

authentication
window pops up asking for username-password. How can I implement the

same in IIS ?

This way I can avoid having to programmatically implement login feature.
Can anyone please throw light on this ?

Thanks
SeeSharp.



Nov 17 '05 #11

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

Similar topics

1
by: conradwt | last post by:
Hi, I'm looking to implement login/registration system in PHP5 and MySQL. Thus, I have come across alot of resources and source code to perform this task. However, I'm wondering, what's the best...
4
by: Marty Underwood | last post by:
Okay the subject line explains a scenario I just had to tackle but I am looking for a better way. The current way: 1) Use forms authentication. 2) Query Active Directory and bind to a user...
1
by: Malik Asif Joyia | last post by:
Hello I want to implement the forms based authentication. for a sub directory in my webapplication. I have allready applied Forms based authentication in my webapplication ,, I have added a folder...
7
by: - Steve - | last post by:
I have forms based authentication working, using my Active Directory for authentication. I have a web page that creates a user in active directory. When I was using IIS authentication it worked...
9
by: Benny Ng | last post by:
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....
1
by: Jéjé | last post by:
Hi, I have to implement a security like this: 1. The user is logged into a home made extranet in PHP, a directory server is used (not the active directory) (its a form based authentication) 2....
10
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
2
by: P Webster | last post by:
We recently moved a web site that validated user credentials in Active Directory from IIS 5.1 to IIS 6, and the validation code no longer works. The web.config file is set to Windows authentication...
3
by: igotyourdotnet | last post by:
I'm creating a new intranet web site in VS 05 .NET 2.0 and I don't want my users to log into the site at all. How can get thier username and show their full name on my web page and how can I give...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.