473,583 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I use forms authentication on specific directories?

My app has an 'admin' folder. This is the only directory i need to apply
forms authentication to.

Googling seems to indicate that the solution is to just give the admin
folder it's own config file and set the authentication rules there.

However, when I do that, I get this error:

--------------------------
Parser Error Message: It is an error to use a section registered as
allowDefinition ='MachineToAppl ication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS.
--------------------------------

Which, from what I can tell, is saying I can't do forms authentication in a
directory unless that directory is also an application.

So, is there a way to do what I want to do? I want one subdirectory of my
application (not an application itself) to use forms authentication.

-Darrel
Apr 22 '06 #1
2 1648
Hi,

you need to declare the authentication method used on root web.config with
<authenicatio n> element, there's no way around that .

But with <location> tags in root web.config or web.config files in
subdirectories you can provide <authorizatio n> elements to specify if
accessing a folder (or specific aspx page) needs authentication. E.g in root
web.config put
<authorizatio n>
<allow users="*" />
</authorization>

But for specific subfolders you can deny it.

<location path="subfolder ">
<system.web>
<authorizatio n>
<deny users="?" />
</authorization>
</system.web>
</location>

(or place this into separate web.config file on subdirectiry when <location>
wouldn't be needed)

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Darrel" <no*****@nospam .com> wrote in message
news:uO******** ******@TK2MSFTN GP05.phx.gbl...
My app has an 'admin' folder. This is the only directory i need to apply
forms authentication to.

Googling seems to indicate that the solution is to just give the admin
folder it's own config file and set the authentication rules there.

However, when I do that, I get this error:

--------------------------
Parser Error Message: It is an error to use a section registered as
allowDefinition ='MachineToAppl ication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS.
--------------------------------

Which, from what I can tell, is saying I can't do forms authentication in
a directory unless that directory is also an application.

So, is there a way to do what I want to do? I want one subdirectory of my
application (not an application itself) to use forms authentication.

-Darrel

Apr 22 '06 #2
<location path="subfolder ">
<system.web>
<authorizatio n>
<deny users="?" />
</authorization>
</system.web>
</location>

(or place this into separate web.config file on subdirectiry when
<location> wouldn't be needed)


Thanks, Teemu. That worked perfectly!

-Darrel
Apr 22 '06 #3

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

Similar topics

6
4809
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 Authentication set up and it worked just fine. Then I realized that I needed to have some pages unsecure. I then created 2 directories. One named Secure and...
1
1989
by: JC | last post by:
I have several applications that use forms authentication and they are currently setup to use a single login page. Everything works fine under v1.0 of the framework and everything works fine if I have all applications running under v1.1. However, I need the login page and a few apps to be running under using v1.0 with other applications...
2
2539
by: Jenny | last post by:
Hi all How can the following problem be solved: My application uses forms authentication. Normally a start.aspx page should be send to the client before login.aspx is shown. Start.aspx consist of simple JScript writing a cookie about screen resolution followed by an automatic transfer to login.aspx. This page is therefore test whether...
0
270
by: Dotnet Guy | last post by:
I have set up forms authentication for my web application. I have several subdirectories inside a main directory and I have forms authentication for each of my sub directories. In the logon page when the user is authenticated, I have FormsAuthentication.RedirectFromLoginPage(txtLogonid.Text, False) And in the web.config files of my...
5
1655
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!
3
1298
by: branton ellerbee | last post by:
How do you implement a login control across multiple .aspx pages that allows access to pages and directories with the application you are designing? For example, imagine a login control that is located on everypage you go to until you have logged into the application. Once you have logged in, then the control goes away and maybe replaced...
1
2523
by: cab0san | last post by:
I have several applications all on the same server. I would like them to all use the same login page. Example: http://server1/customers/app1.aspx http://server1/suppliers/byregion/app2.aspx I have a login page located in the root of the same server: http://server1/login.aspx
0
2065
by: William F. Zachmann | last post by:
A web site that will run on Windows Server 2003 and IIS 6.0 needs to provide three levels of access, one for the public and two others for two levels of subscribers. This is a port of a prior site that runs on an old version of the Netscape Web server (which manages user authentication and access). The three levels of access are currently...
6
2858
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server with SQL 2000. All new code is being written in C# using ASP.NET and we are using forms authentication to control access to particular...
0
8182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6579
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
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...
0
5374
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...
0
3818
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...
0
3843
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2333
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
1
1433
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1157
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...

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.