473,657 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

<authenticati on mode="Forms">
<forms name="CartAdmin " loginUrl="admin/Login.aspx" timeout="30"
protection="All " path="/admin" />
</authentication>
<authorizatio n>
<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 16620
Hi Maziar Alfatoun,

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

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

<system.web>

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

<compilation debug="true" />

</system.web>

<location path="admin">
<system.web>
<authorizatio n>
<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

<authenticati on mode="Forms">
<forms name="CartAdmin " loginUrl="admin/Login.aspx" timeout="30"
protection="All " path="/admin" />
</authentication>
<authorizatio n>
<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

<authenticati on 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" ?>
<configuratio n>
<system.web>
<authorizatio n>
<allow users="admin" />
<deny users="*" />
</authorization>
</system.web>
</configuration>

Thanks
Maziar Aflatoun
"Chua Wen Ching" <ch************ @nospam.hotmail .com> wrote in message
news:7E******** *************** ***********@mic rosoft.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" ?>
<configuratio n>

<system.web>

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

<compilation debug="true" />

</system.web>

<location path="admin">
<system.web>
<authorizatio n>
<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

<authenticati on mode="Forms">
<forms name="CartAdmin " loginUrl="admin/Login.aspx" timeout="30"
protection="All " path="/admin" />
</authentication>
<authorizatio n>
<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
3821
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* access config files. This is version 3, which is a big overhaul. It extends ConfigObj to reading config files with sections and various other simplifications. I find ConfigObj extremely easy to use and use it for reading config files and data...
2
3842
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. My main domain points to the root /. space in my account and contains various htm and aspx pages that work just fine (well I had problems with Session state but that's another story!) the web.config file for this 'app' resides in
1
1292
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 in my webapplication for the admin side of the webside and want to implement forms based authentication. so that admin users can be checked for security. i added a web.config file. but when i add the code below <authorization> <deny...
1
10620
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
6395
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. Virtual directory is £ºhttp://localhost/main Sub-directory is : http://localhost/main/reminder
3
1082
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 my form and load the form accordingly? in other words can i store a form object in the config file? or can i type cast a string to a form object, any suggestions are greatly appreciated. Thanks in advance Ken
1
3124
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
1571
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 of a web app and decided to try it with a regular app). What I discovered was that for some reason the .config file is not being copied with Primary Output. In checking a few other apps for which I had written installers I found that they too...
4
1773
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 specify in the config file all of the pages that require a user to login otherwise the page will redirect if the user is not logged in. config.php looks like this: ----------------------
3
5515
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
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.