locked
Asp.net Security RRS feed

  • Question

  • User-1630384837 posted

    Please,

    tell me how to apply security in my application as folder wise.

    Sunday, September 7, 2014 2:12 AM

Answers

  • User281315223 posted

    Could you be a bit more specific?

    In general, an ASP.NET application is going to be compiled, so your users aren't really going to have access to your Solution's folder structure directly (unless you explicitly allow them access). ASP.NET allows you to configure file access / authorization, within the web.config using <allow> and <deny> attributes similar to the example below :

    <configuration>
        <location path="YourDirectory">
            <system.web>
                <authorization>
                    <deny users="?"/>
                </authorization>
            </system.web>
        </location>
        <location path="YourOtherDirectory/Admin">
            <system.web>
                <authorization>
                    <allow users="Admin"/>
                    <deny users="*"/>
                </authorization>
            </system.web>
        </location>
    </configuration>

    Additionally, you could simply place web.config files within these folders as well (instead of applying this in a single web.config) and control it on a folder-by-folder basis. You can read a bit more on implementing this type of authorization below :

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, September 7, 2014 7:59 AM