473,386 Members | 1,812 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,386 software developers and data experts.

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='MachineToApplication' 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 1640
Hi,

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

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

But for specific subfolders you can deny it.

<location path="subfolder">
<system.web>
<authorization>
<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**************@TK2MSFTNGP05.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='MachineToApplication' 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>
<authorization>
<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
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...
1
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...
2
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...
0
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...
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!
3
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...
1
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 ...
0
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...
6
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...
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...
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
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
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
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,...
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...

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.