Showing posts with label subdirectory. Show all posts
Showing posts with label subdirectory. Show all posts

Thursday, March 22, 2012

Trouble with forms authentication

I am trying to password protect a subdirectory using forms authentication. I
am using the "Location" tag to specify the directory to be protected. The
login.aspx page is in the root directory of the app. Here is the web.config:
<location path="Admin">
<system.web>
<authentication mode="Forms">
<forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="Admin" password="pass"/>
<user name="Ashlyinn" password="pass"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
The problem is event if I put in the proper valid credentials authorization
fails.
Any suggestions?
Thanks, Justin.Hey Justin,
When u mean authorization do u mean th user can login but he is not
getting the appropriate resources?
That means is he authenticated?
"Justin" wrote:

> I am trying to password protect a subdirectory using forms authentication.
I
> am using the "Location" tag to specify the directory to be protected. The
> login.aspx page is in the root directory of the app. Here is the web.confi
g:
> <location path="Admin">
> <system.web>
> <authentication mode="Forms">
> <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="
30">
> <credentials passwordFormat="Clear">
> <user name="Admin" password="pass"/>
> <user name="Ashlyinn" password="pass"/>
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?"/>
> </authorization>
> </system.web>
> </location>
> The problem is event if I put in the proper valid credentials authorizatio
n
> fails.
> Any suggestions?
> Thanks, Justin.
No, the user is not authenticated at all, meaning it goes to the else
statement in the code below no matter what:
private void Login_Click(object sender, System.EventArgs e)
{
if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
{
FormsAuthentication.RedirectFromLoginPage(Email.Text, false);
}
else
{
lblStatus.Text = "Authentication Failed.";
}
}
"Patrick.O.Ige" wrote:
> Hey Justin,
> When u mean authorization do u mean th user can login but he is no
t
> getting the appropriate resources?
> That means is he authenticated?
>
> "Justin" wrote:
>
Ok Justin so No authentication at al!!
Are u sure u have all the right settings?
First check to see whether u have Anonymous Auth checked in IIS.
Got to ur WebServer and right click on ur Virtual Directory of ur
Application >Go to Properties >Directory security TAB> On the Anonymouse
Access and Auth control
click EDIT and make sure u check Anonymous access!
Also make sure u have :- <identity impersonate="true" /> placed in ur
web.config
Try all that!
Let me know if it works for u..if not post ur Question.
"Justin" wrote:
> No, the user is not authenticated at all, meaning it goes to the else
> statement in the code below no matter what:
> private void Login_Click(object sender, System.EventArgs e)
> {
> if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> {
> FormsAuthentication.RedirectFromLoginPage(Email.Text, false);
> }
> else
> {
> lblStatus.Text = "Authentication Failed.";
> }
> }
>
> "Patrick.O.Ige" wrote:
>
Well, unfortunetly it still does not work. I am sure its something simle but
sometimes simple problems are hard to fix.
Thanks for the help.
Justin.
"Patrick.O.Ige" wrote:
> Ok Justin so No authentication at al!!
> Are u sure u have all the right settings?
> First check to see whether u have Anonymous Auth checked in IIS.
> Got to ur WebServer and right click on ur Virtual Directory of ur
> Application >Go to Properties >Directory security TAB> On the Anonymouse
> Access and Auth control
> click EDIT and make sure u check Anonymous access!
> Also make sure u have :- <identity impersonate="true" /> placed in ur
> web.config
> Try all that!
> Let me know if it works for u..if not post ur Question.
>
> "Justin" wrote:
>
Just try looking through ur code carefully ok!
Justin try looking through:-Forms Authentication here:-
http://samples.gotdotnet.com/quickstart/aspplus/
or
http://support.microsoft.com/defaul...r />
0&SD=MSDN
or
http://www.costudio.com/form_auth.asp
"Justin" wrote:
> Well, unfortunetly it still does not work. I am sure its something simle b
ut
> sometimes simple problems are hard to fix.
> Thanks for the help.
> Justin.
> "Patrick.O.Ige" wrote:
>
This link shoud help for sure:-
http://www.15seconds.com/issue/020220.htm
And by the way in ur Web.Config why don't u do:-
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="login.aspx"
protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="jeff" password="test" />
<user name="mike" password="test" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
And then if u want to perform Auhtorization use the location PATH and specif
y
whch users can see access contents of a particular FOLDER!
GDLUCK
"Patrick.O.Ige" wrote:
> Just try looking through ur code carefully ok!
> Justin try looking through:-Forms Authentication here:-
> http://samples.gotdotnet.com/quickstart/aspplus/
> or
> http://support.microsoft.com/defaul.../>
240&SD=MSDN
> or
> http://www.costudio.com/form_auth.asp
>
>
> "Justin" wrote:
>
Ok, I am getting closer to getting this to work the only problem is that
after loging in it redirects to default.aspx in the root directory instead o
f
admin/default.aspx.
How do I manualy set redirect url?
"Patrick.O.Ige" wrote:
> This link shoud help for sure:-
> http://www.15seconds.com/issue/020220.htm
> And by the way in ur Web.Config why don't u do:-
> <configuration>
> <system.web>
> <customErrors mode="Off"/>
> <authentication mode="Forms">
> <forms name="appNameAuth" path="/" loginUrl="login.aspx"
> protection="All" timeout="30">
> <credentials passwordFormat="Clear">
> <user name="jeff" password="test" />
> <user name="mike" password="test" />
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?" />
> </authorization>
> </system.web>
> </configuration>
> And then if u want to perform Auhtorization use the location PATH and spec
ify
> whch users can see access contents of a particular FOLDER!
> GDLUCK
>
>
> "Patrick.O.Ige" wrote:
>

Trouble with forms authentication

I am trying to password protect a subdirectory using forms authentication. I
am using the "Location" tag to specify the directory to be protected. The
login.aspx page is in the root directory of the app. Here is the web.config:

<location path="Admin">
<system.web>
<authentication mode="Forms">
<forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="Admin" password="pass"/>
<user name="Ashlyinn" password="pass"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location
The problem is event if I put in the proper valid credentials authorization
fails.

Any suggestions?

Thanks, Justin.Hey Justin,
When u mean authorization do u mean th user can login but he is not
getting the appropriate resources?
That means is he authenticated?

"Justin" wrote:

> I am trying to password protect a subdirectory using forms authentication. I
> am using the "Location" tag to specify the directory to be protected. The
> login.aspx page is in the root directory of the app. Here is the web.config:
> <location path="Admin">
> <system.web>
> <authentication mode="Forms">
> <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> <credentials passwordFormat="Clear">
> <user name="Admin" password="pass"/>
> <user name="Ashlyinn" password="pass"/>
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?"/>
> </authorization>
> </system.web>
> </location>
> The problem is event if I put in the proper valid credentials authorization
> fails.
> Any suggestions?
> Thanks, Justin.
No, the user is not authenticated at all, meaning it goes to the else
statement in the code below no matter what:

private void Login_Click(object sender, System.EventArgs e)
{
if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
{
FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
}
else
{
lblStatus.Text = "Authentication Failed.";
}
}

"Patrick.O.Ige" wrote:

> Hey Justin,
> When u mean authorization do u mean th user can login but he is not
> getting the appropriate resources?
> That means is he authenticated?
>
> "Justin" wrote:
> > I am trying to password protect a subdirectory using forms authentication. I
> > am using the "Location" tag to specify the directory to be protected. The
> > login.aspx page is in the root directory of the app. Here is the web.config:
> > <location path="Admin">
> > <system.web>
> > <authentication mode="Forms">
> > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > <credentials passwordFormat="Clear">
> > <user name="Admin" password="pass"/>
> > <user name="Ashlyinn" password="pass"/>
> > </credentials>
> > </forms>
> > </authentication>
> > <authorization>
> > <deny users="?"/>
> > </authorization>
> > </system.web>
> > </location>
> > The problem is event if I put in the proper valid credentials authorization
> > fails.
> > Any suggestions?
> > Thanks, Justin.
Ok Justin so No authentication at al!!
Are u sure u have all the right settings?
First check to see whether u have Anonymous Auth checked in IIS.
Got to ur WebServer and right click on ur Virtual Directory of ur
Application >Go to Properties >Directory security TAB> On the Anonymouse
Access and Auth control
click EDIT and make sure u check Anonymous access!
Also make sure u have :- <identity impersonate="true" /> placed in ur
web.config
Try all that!
Let me know if it works for u..if not post ur Question.

"Justin" wrote:

> No, the user is not authenticated at all, meaning it goes to the else
> statement in the code below no matter what:
> private void Login_Click(object sender, System.EventArgs e)
> {
> if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> {
> FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> }
> else
> {
> lblStatus.Text = "Authentication Failed.";
> }
> }
>
> "Patrick.O.Ige" wrote:
> > Hey Justin,
> > When u mean authorization do u mean th user can login but he is not
> > getting the appropriate resources?
> > That means is he authenticated?
> > "Justin" wrote:
> > > I am trying to password protect a subdirectory using forms authentication. I
> > > am using the "Location" tag to specify the directory to be protected. The
> > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > <location path="Admin">
> > > <system.web>
> > > <authentication mode="Forms">
> > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > <credentials passwordFormat="Clear">
> > > <user name="Admin" password="pass"/>
> > > <user name="Ashlyinn" password="pass"/>
> > > </credentials>
> > > </forms>
> > > </authentication>
> > > <authorization>
> > > <deny users="?"/>
> > > </authorization>
> > > </system.web>
> > > </location>
> > > > The problem is event if I put in the proper valid credentials authorization
> > > fails.
> > > > Any suggestions?
> > > > Thanks, Justin.
Well, unfortunetly it still does not work. I am sure its something simle but
sometimes simple problems are hard to fix.

Thanks for the help.

Justin.

"Patrick.O.Ige" wrote:

> Ok Justin so No authentication at al!!
> Are u sure u have all the right settings?
> First check to see whether u have Anonymous Auth checked in IIS.
> Got to ur WebServer and right click on ur Virtual Directory of ur
> Application >Go to Properties >Directory security TAB> On the Anonymouse
> Access and Auth control
> click EDIT and make sure u check Anonymous access!
> Also make sure u have :- <identity impersonate="true" /> placed in ur
> web.config
> Try all that!
> Let me know if it works for u..if not post ur Question.
>
> "Justin" wrote:
> > No, the user is not authenticated at all, meaning it goes to the else
> > statement in the code below no matter what:
> > private void Login_Click(object sender, System.EventArgs e)
> > {
> > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > {
> > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > }
> > else
> > {
> > lblStatus.Text = "Authentication Failed.";
> > }
> > }
> > "Patrick.O.Ige" wrote:
> > > Hey Justin,
> > > When u mean authorization do u mean th user can login but he is not
> > > getting the appropriate resources?
> > > That means is he authenticated?
> > > > > > "Justin" wrote:
> > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > am using the "Location" tag to specify the directory to be protected. The
> > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > <location path="Admin">
> > > > <system.web>
> > > > <authentication mode="Forms">
> > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > <credentials passwordFormat="Clear">
> > > > <user name="Admin" password="pass"/>
> > > > <user name="Ashlyinn" password="pass"/>
> > > > </credentials>
> > > > </forms>
> > > > </authentication>
> > > > <authorization>
> > > > <deny users="?"/>
> > > > </authorization>
> > > > </system.web>
> > > > </location>
> > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > fails.
> > > > > > Any suggestions?
> > > > > > Thanks, Justin.
Just try looking through ur code carefully ok!

Justin try looking through:-Forms Authentication here:-
http://samples.gotdotnet.com/quickstart/aspplus/
o
http://support.microsoft.com/defaul...Q301240&SD=MSDN
or
http://www.costudio.com/form_auth.asp

"Justin" wrote:

> Well, unfortunetly it still does not work. I am sure its something simle but
> sometimes simple problems are hard to fix.
> Thanks for the help.
> Justin.
> "Patrick.O.Ige" wrote:
> > Ok Justin so No authentication at al!!
> > Are u sure u have all the right settings?
> > First check to see whether u have Anonymous Auth checked in IIS.
> > Got to ur WebServer and right click on ur Virtual Directory of ur
> > Application >Go to Properties >Directory security TAB> On the Anonymouse
> > Access and Auth control
> > click EDIT and make sure u check Anonymous access!
> > Also make sure u have :- <identity impersonate="true" /> placed in ur
> > web.config
> > Try all that!
> > Let me know if it works for u..if not post ur Question.
> > "Justin" wrote:
> > > No, the user is not authenticated at all, meaning it goes to the else
> > > statement in the code below no matter what:
> > > > private void Login_Click(object sender, System.EventArgs e)
> > > {
> > > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > > {
> > > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > > }
> > > else
> > > {
> > > lblStatus.Text = "Authentication Failed.";
> > > }
> > > }
> > > > > > "Patrick.O.Ige" wrote:
> > > > > Hey Justin,
> > > > When u mean authorization do u mean th user can login but he is not
> > > > getting the appropriate resources?
> > > > That means is he authenticated?
> > > > > > > > > > "Justin" wrote:
> > > > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > > am using the "Location" tag to specify the directory to be protected. The
> > > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > > > <location path="Admin">
> > > > > <system.web>
> > > > > <authentication mode="Forms">
> > > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > > <credentials passwordFormat="Clear">
> > > > > <user name="Admin" password="pass"/>
> > > > > <user name="Ashlyinn" password="pass"/>
> > > > > </credentials>
> > > > > </forms>
> > > > > </authentication>
> > > > > <authorization>
> > > > > <deny users="?"/>
> > > > > </authorization>
> > > > > </system.web>
> > > > > </location>
> > > > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > > fails.
> > > > > > > > Any suggestions?
> > > > > > > > Thanks, Justin.
This link shoud help for sure:-
http://www.15seconds.com/issue/020220.htm
And by the way in ur Web.Config why don't u do:-
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="login.aspx"
protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="jeff" password="test" />
<user name="mike" password="test" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration
And then if u want to perform Auhtorization use the location PATH and specify
whch users can see access contents of a particular FOLDER!
GDLUCK

"Patrick.O.Ige" wrote:

> Just try looking through ur code carefully ok!
> Justin try looking through:-Forms Authentication here:-
> http://samples.gotdotnet.com/quickstart/aspplus/
> or
> http://support.microsoft.com/defaul...Q301240&SD=MSDN
> or
> http://www.costudio.com/form_auth.asp
>
>
> "Justin" wrote:
> > Well, unfortunetly it still does not work. I am sure its something simle but
> > sometimes simple problems are hard to fix.
> > Thanks for the help.
> > Justin.
> > "Patrick.O.Ige" wrote:
> > > Ok Justin so No authentication at al!!
> > > Are u sure u have all the right settings?
> > > First check to see whether u have Anonymous Auth checked in IIS.
> > > Got to ur WebServer and right click on ur Virtual Directory of ur
> > > Application >Go to Properties >Directory security TAB> On the Anonymouse
> > > Access and Auth control
> > > click EDIT and make sure u check Anonymous access!
> > > Also make sure u have :- <identity impersonate="true" /> placed in ur
> > > web.config
> > > Try all that!
> > > Let me know if it works for u..if not post ur Question.
> > > > > > "Justin" wrote:
> > > > > No, the user is not authenticated at all, meaning it goes to the else
> > > > statement in the code below no matter what:
> > > > > > private void Login_Click(object sender, System.EventArgs e)
> > > > {
> > > > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > > > {
> > > > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > > > }
> > > > else
> > > > {
> > > > lblStatus.Text = "Authentication Failed.";
> > > > }
> > > > }
> > > > > > > > > > "Patrick.O.Ige" wrote:
> > > > > > > Hey Justin,
> > > > > When u mean authorization do u mean th user can login but he is not
> > > > > getting the appropriate resources?
> > > > > That means is he authenticated?
> > > > > > > > > > > > > > "Justin" wrote:
> > > > > > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > > > am using the "Location" tag to specify the directory to be protected. The
> > > > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > > > > > <location path="Admin">
> > > > > > <system.web>
> > > > > > <authentication mode="Forms">
> > > > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > > > <credentials passwordFormat="Clear">
> > > > > > <user name="Admin" password="pass"/>
> > > > > > <user name="Ashlyinn" password="pass"/>
> > > > > > </credentials>
> > > > > > </forms>
> > > > > > </authentication>
> > > > > > <authorization>
> > > > > > <deny users="?"/>
> > > > > > </authorization>
> > > > > > </system.web>
> > > > > > </location>
> > > > > > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > > > fails.
> > > > > > > > > > Any suggestions?
> > > > > > > > > > Thanks, Justin.
Ok, I am getting closer to getting this to work the only problem is that
after loging in it redirects to default.aspx in the root directory instead of
admin/default.aspx.

How do I manualy set redirect url?

"Patrick.O.Ige" wrote:

> This link shoud help for sure:-
> http://www.15seconds.com/issue/020220.htm
> And by the way in ur Web.Config why don't u do:-
> <configuration>
> <system.web>
> <customErrors mode="Off"/>
> <authentication mode="Forms">
> <forms name="appNameAuth" path="/" loginUrl="login.aspx"
> protection="All" timeout="30">
> <credentials passwordFormat="Clear">
> <user name="jeff" password="test" />
> <user name="mike" password="test" />
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?" />
> </authorization>
> </system.web>
> </configuration>
> And then if u want to perform Auhtorization use the location PATH and specify
> whch users can see access contents of a particular FOLDER!
> GDLUCK
>
>
> "Patrick.O.Ige" wrote:
> > Just try looking through ur code carefully ok!
> > Justin try looking through:-Forms Authentication here:-
> > http://samples.gotdotnet.com/quickstart/aspplus/
> > or
> > http://support.microsoft.com/defaul...Q301240&SD=MSDN
> > or
> > http://www.costudio.com/form_auth.asp
> > "Justin" wrote:
> > > Well, unfortunetly it still does not work. I am sure its something simle but
> > > sometimes simple problems are hard to fix.
> > > > Thanks for the help.
> > > > Justin.
> > > > "Patrick.O.Ige" wrote:
> > > > > Ok Justin so No authentication at al!!
> > > > Are u sure u have all the right settings?
> > > > First check to see whether u have Anonymous Auth checked in IIS.
> > > > Got to ur WebServer and right click on ur Virtual Directory of ur
> > > > Application >Go to Properties >Directory security TAB> On the Anonymouse
> > > > Access and Auth control
> > > > click EDIT and make sure u check Anonymous access!
> > > > Also make sure u have :- <identity impersonate="true" /> placed in ur
> > > > web.config
> > > > Try all that!
> > > > Let me know if it works for u..if not post ur Question.
> > > > > > > > > > "Justin" wrote:
> > > > > > > No, the user is not authenticated at all, meaning it goes to the else
> > > > > statement in the code below no matter what:
> > > > > > > > private void Login_Click(object sender, System.EventArgs e)
> > > > > {
> > > > > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > > > > {
> > > > > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > > > > }
> > > > > else
> > > > > {
> > > > > lblStatus.Text = "Authentication Failed.";
> > > > > }
> > > > > }
> > > > > > > > > > > > > > "Patrick.O.Ige" wrote:
> > > > > > > > > Hey Justin,
> > > > > > When u mean authorization do u mean th user can login but he is not
> > > > > > getting the appropriate resources?
> > > > > > That means is he authenticated?
> > > > > > > > > > > > > > > > > > "Justin" wrote:
> > > > > > > > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > > > > am using the "Location" tag to specify the directory to be protected. The
> > > > > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > > > > > > > <location path="Admin">
> > > > > > > <system.web>
> > > > > > > <authentication mode="Forms">
> > > > > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > > > > <credentials passwordFormat="Clear">
> > > > > > > <user name="Admin" password="pass"/>
> > > > > > > <user name="Ashlyinn" password="pass"/>
> > > > > > > </credentials>
> > > > > > > </forms>
> > > > > > > </authentication>
> > > > > > > <authorization>
> > > > > > > <deny users="?"/>
> > > > > > > </authorization>
> > > > > > > </system.web>
> > > > > > > </location>
> > > > > > > > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > > > > fails.
> > > > > > > > > > > > Any suggestions?
> > > > > > > > > > > > Thanks, Justin.

Tuesday, March 13, 2012

Troubled authentication in subdirectories

Hi there,

I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.

The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:

http://www.theserverside.net/tt/art...mAuthentication
The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the protected
subdirectory.

Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:

Error 1 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. D:\WebSites\RegencyWeb\web.config 42

If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.

So how can I solve this?

Thanks for any insight,

-BentonYou can only have one authentication section in a web application. You don't
solve this, it's by design. The only thing you can do is alter the login
page based upon where the user is coming from, ie: which subdirectory. The
only other way is to make the subdirectories their own independent
application spaces. Of course, you can specify whatever authorization
limitations you want in the specific subdirectories, that doesn't matter,
just keeping in mind there can only be one authentication section and one
logon page.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Benton" <conversar@.gmail.comwrote in message
news:56jam8F27vd09U1@.mid.individual.net...

Quote:

Originally Posted by

Hi there,
>
I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.
>
The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:
>
http://www.theserverside.net/tt/art...mAuthentication
>
The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the
protected subdirectory.
>
Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:
>
Error 1 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. D:\WebSites\RegencyWeb\web.config 42
>
If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.
>
So how can I solve this?
>
Thanks for any insight,
>
-Benton

Troubled authentication in subdirectories

Hi there,
I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.
The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:
[url]http://www.theserverside.net/tt/articles/showarticle.tss?id=FormAuthentication[/ur
l]
The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the protected
subdirectory.
Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:
Error 1 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. D:\WebSites\RegencyWeb\web.config 42
If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.
So how can I solve this?
Thanks for any insight,
-BentonYou can only have one authentication section in a web application. You don't
solve this, it's by design. The only thing you can do is alter the login
page based upon where the user is coming from, ie: which subdirectory. The
only other way is to make the subdirectories their own independent
application spaces. Of course, you can specify whatever authorization
limitations you want in the specific subdirectories, that doesn't matter,
just keeping in mind there can only be one authentication section and one
logon page.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"Benton" <conversar@.gmail.com> wrote in message
news:56jam8F27vd09U1@.mid.individual.net...
> Hi there,
> I want to have an unrestricted root directory and some protected
> subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
> have its own Login.aspx page.
> The following article is a good start, but it uses a single Login.aspx
> located in the root directory to protect a subdirectory:
> [url]http://www.theserverside.net/tt/articles/showarticle.tss?id=FormAuthentication[/
url]
> The technique described in the article uses a "location" section in
> web.config, where a custom "system.web" section is defined for the
> protected subdirectory.
> Now if I put the "authentication mode" section inside this custom
> "system.web" for the subdirectory (so I can define the subdirectory Login
> page), I get a compiler error on the "authentication" section:
> Error 1 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. D:\WebSites\RegencyWeb\web.config 42
> If I put the "authentication" section in the root "system.web" (outside of
> the location's "system.web") then the application compiles fine, but I'm
> limited to a single Login.aspx for the application.
> So how can I solve this?
> Thanks for any insight,
> -Benton