Basic Forms Authentication question

R

R-D-C

I can't get this damn thing to work at all.

I have a virtual directory set up with anonymous access only, web.config
contains the following but when I go to the site it ignores the security and
never redirects to login.aspx. I know this will be a stupid problem but
please help!

<configuration>

<system.web>

<authentication mode="Forms">

<forms name="ASPXAUTH"

loginUrl="login.aspx"

protection="All"

path="/"/>

</authentication>

</system.web>

</configuration>
 
M

Michal A. Valasek

| I have a virtual directory set up with anonymous access only, web.config
| contains the following but when I go to the site it ignores the security
and
| never redirects to login.aspx. I know this will be a stupid problem but
| please help!

you must specify not only authentication, but also the authorization
conditions. The following web.config example should help:

<configuration>
<system.web>
<!-- here you would setup authentication method -->
<authentication mode="Forms">
<forms loginUrl="/Default.aspx" timeout="30" path="/" protection="All"
/>
</authentication>
<!--
now specify authorization for root folder
'*' means all users, '?' means anonymous users
the following setting will allow access to all users except anonymous
-->
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
</system.web>
<!--
here we specify different rights for the 'noauth' folder, where
everyone
(even anonymous users) has access
-->
<location path="noauth">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<!--
here we specify different rights for the 'admin' folder, where only
members of 'Admins' role can go
-->
<location path="admin">
<system.web>
<authorization>
<allow roles="Admins" />
<deny users="*" />
</authorization>
</system.web>
</location>
</configuration>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top