web config - ASP.Net - How to determine if web request is to a resource that allows anonymous users or not -


i have denied anonymous access entire application using following web.config setting:

<authorization>    <deny users="?" /> </authorization> 

then, various paths, have allowed anonymous access using web.config settings such this:

<location path="home/showlogin"> <system.web>   <authorization>     <allow users="*"/>   </authorization> </system.web> 

i'd able determine during processing of given request whether requested url path allows anonymous users or whether request path denies anonymous users.

what elegant way of determining this?

you can use following code collection of location elements:

configuration config = webconfigurationmanager.openwebconfiguration("~"); foreach (configurationlocation location in config.locations) {   // work location object } 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -