.NET: understanding web.config in asp.net

Posted by mark smith on Stack Overflow See other posts from Stack Overflow or by mark smith
Published on 2010-04-12T13:17:22Z Indexed on 2010/04/12 13:23 UTC
Read the original article Hit count: 469

Filed under:
|

Hi there,

Does anyone know of a good link to explain how to use the web.config......

For example, i am using forms authentication... and i notice there is a system.web and then it closed /system.web and then below configuration there are additional location tags

here is an example, if you ntoice there is an authentication mode=forms with authorization i presume this is the ROOT....... It is also self contained within a system.web .... Below this there are more location= with system.web tags....

I have never really understand what i am actually doing.. I have tried checkign the MSDN documentation but still i don't fully understand up....

Can anyone help?

If you notice with my example.... everything is stored in 1 web.config... i thought the standard waas create a standard web.config and then create another web.config in the directory where i wish to protect it..???

<configuration>

     <system.web>
           <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />

           <authentication mode="Forms">
        <forms loginUrl="Login.aspx" defaultUrl="Login.aspx" cookieless="UseCookies" timeout="60"/>
    </authentication>

    <authorization>
        <allow users="*"/>
    </authorization>

       </system.web>


<location path="Forms">
    <system.web>
        <authorization>
            <deny users="?"/>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>
<location path="Forms/Seguridad">
    <system.web>
        <authorization>
            <allow roles="Administrador"/>
            <deny users="?"/>
        </authorization>
    </system.web>
</location>

© Stack Overflow or respective owner

Related posts about web.config

Related posts about ASP.NET