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

Web.config file protecting sub-folders only

Hi,

I'm trying to protect one of my subfolders from Web.config file in my root
folder. Here is my directory structure

/ // My shopping cart
/admin // Shopping cart admin which needs to be protected

Now in my Web.config how can I protect just the /admin folder (which is not
a virtual directory) it's simply a folder in my / folder?

I tried

<authentication mode="Forms">
<forms name="CartAdmin" loginUrl="admin/Login.aspx" timeout="30"
protection="All" path="/admin" />
</authentication>
<authorization>
<deny users="?" />
</authorization>

but it doesn't work. Even when you try to access files in my / folder it
redirects you to my /admin/login.aspx file

Thank you
Maz
Nov 16 '05 #1
2 16608
Hi Maziar Alfatoun,

Can you try this and let me know whether it is working or not?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<system.web>

<authentication mode="Forms">
<forms name="CartAdmin" loginUrl="Login.aspx" protection="All" timeout="30"
path="/" />
</authentication>

<compilation debug="true" />

</system.web>

<location path="admin">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>

</configuration>

Please correct me if i am wrong. Thanks. Hope it helps.
--
Regards,
Chua Wen Ching :)
"Maziar Aflatoun" wrote:
Hi,

I'm trying to protect one of my subfolders from Web.config file in my root
folder. Here is my directory structure

/ // My shopping cart
/admin // Shopping cart admin which needs to be protected

Now in my Web.config how can I protect just the /admin folder (which is not
a virtual directory) it's simply a folder in my / folder?

I tried

<authentication mode="Forms">
<forms name="CartAdmin" loginUrl="admin/Login.aspx" timeout="30"
protection="All" path="/admin" />
</authentication>
<authorization>
<deny users="?" />
</authorization>

but it doesn't work. Even when you try to access files in my / folder it
redirects you to my /admin/login.aspx file

Thank you
Maz

Nov 16 '05 #2
Thanks... I already got it to work using the following directives in my
Web.Config file

<authentication mode="Forms">
<forms loginUrl="admin/Login.aspx" protection="All" timeout="30"
path="/">
<credentials passwordFormat="Clear">
<user name="admin" password="12345" />
</credentials>
</forms>
</authentication>

and in the Web.Config file of my sub-folders
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<authorization>
<allow users="admin" />
<deny users="*" />
</authorization>
</system.web>
</configuration>

Thanks
Maziar Aflatoun
"Chua Wen Ching" <ch************@nospam.hotmail.com> wrote in message
news:7E**********************************@microsof t.com...
Hi Maziar Alfatoun,

Can you try this and let me know whether it is working or not?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<system.web>

<authentication mode="Forms">
<forms name="CartAdmin" loginUrl="Login.aspx" protection="All"
timeout="30"
path="/" />
</authentication>

<compilation debug="true" />

</system.web>

<location path="admin">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>

</configuration>

Please correct me if i am wrong. Thanks. Hope it helps.
--
Regards,
Chua Wen Ching :)
"Maziar Aflatoun" wrote:
Hi,

I'm trying to protect one of my subfolders from Web.config file in my
root
folder. Here is my directory structure

/ // My shopping cart
/admin // Shopping cart admin which needs to be protected

Now in my Web.config how can I protect just the /admin folder (which is
not
a virtual directory) it's simply a folder in my / folder?

I tried

<authentication mode="Forms">
<forms name="CartAdmin" loginUrl="admin/Login.aspx" timeout="30"
protection="All" path="/admin" />
</authentication>
<authorization>
<deny users="?" />
</authorization>

but it doesn't work. Even when you try to access files in my / folder it
redirects you to my /admin/login.aspx file

Thank you
Maz

Nov 16 '05 #3

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

Similar topics

4
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply*...
2
by: Martin | last post by:
Hi I am noticing some strange behaviour in some asp.net pages that I have put together and am hoping someone can explain to me what is happening. I have two domains hosted at oneandone.co.uk....
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...
1
by: tom | last post by:
hello all, i have a web application that i want users to be able to change the name of the server and database from a web page. i have got this to work using this... code:-
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....
3
by: twnety0ne | last post by:
Hi, I am trying to implement navigation within my windows application using an external configuration file, i was wondering if i can store a form name in the configuration file, read the file from...
1
by: Atara | last post by:
My application starts with: Module mmcMain Public Sub Main() Debug.WriteLine("Main begin") Dim splashForm As New mcDlgs.cmcDlgSplash2 splashForm.Show() ....
5
by: stand__sure | last post by:
I had occasion tonight to write an installer class that changed something in a config file tonight (I had never had a need to do it, but happened upon a "How To" article that explained it in terms...
4
by: Greg Scharlemann | last post by:
I thought I had a workable approach to specifing which pages required a redirect in a config file, but it appears the way I'm attempting to do it is not going to work. The idea is that I can...
3
by: jonathan184 | last post by:
Basically i am trying to make a config file which will contain to sets of paths for e.g - this file is called config.pl #!/usr/bin/perl #Path1 $sourcedir1 = '/home/test/srcdir1';
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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.