can I set web.config to require authentication only for some files?
From: Bennett Haselton (bennett_at_peacefire.org)
Date: 09/10/04
- Next message: http://www.visual-basic-data-mining.net/forum: "Re: Create xml document"
- Previous message: http://www.visual-basic-data-mining.net/forum: "HTML controls in ASP.NET"
- Next in thread: Lateralus [MCAD]: "Re: can I set web.config to require authentication only for some files?"
- Reply: Lateralus [MCAD]: "Re: can I set web.config to require authentication only for some files?"
- Reply: Steve C. Orr [MVP, MCSD]: "Re: can I set web.config to require authentication only for some files?"
- Messages sorted by: [ date ] [ thread ]
Date: 9 Sep 2004 18:40:23 -0700
If I add this to my web.config file:
<authentication mode="Forms">
<forms name=".ASPXUSERDEMO" loginUrl="login.aspx" protection="All"
timeout="60" />
</authentication>
I can configure the application so that users who try to access a page
in the application, get redirected to login.aspx where they have to
sign in. (And the "signing in" is handled in the codebehind page of
login.aspx.)
What if I want to configure authentication so that it's only required
for certain files? Or only for certain directories? Is there a way
to specify in the <forms> tag or in the <authentication> tag that you
want authentication to apply only to certain files or directories? I
couldn't find any documented way.
If you create a subdirectory and put a web.config file in there with
its own <authentication mode="Forms"> tag, in an attempt to make
authentication apply only to files in that directory, then you get the
ASP.Net error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.
As a last resort I could create a new project directory as a
sub-directory under the top-level project directory, but that sounds
inelegant; it'd be better to be able to manage all files in a single
project.
-Bennett
- Next message: http://www.visual-basic-data-mining.net/forum: "Re: Create xml document"
- Previous message: http://www.visual-basic-data-mining.net/forum: "HTML controls in ASP.NET"
- Next in thread: Lateralus [MCAD]: "Re: can I set web.config to require authentication only for some files?"
- Reply: Lateralus [MCAD]: "Re: can I set web.config to require authentication only for some files?"
- Reply: Steve C. Orr [MVP, MCSD]: "Re: can I set web.config to require authentication only for some files?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|