asp.net - How to allow anonymous user access to virtual directory -
i preventing anonymous users access root application.
/web.config
<system.web> <authorization> <deny users="?" /> </authorization> </system.web>
but allowing anonymous access public resources (images, css, etc.):
<location path="images"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
now, add virtual directory should accessible anonymous users. added configuration based on images path, whenever try access location, redirected login page returnurl
set virtual directory.
<location path="virtualdirectory"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>
in addition, tried specify global authorization within virtual directory's web.config error saying can have once
/virtualdirectory/web.config:
<system.web> <authorization> <allow users="*" /> </authorization> </system.web>
how can allow anonymous access virtual directory when root application preventing anonymous access?
in global web.config encapsulate the
<system.web> <authorization> <deny users="?" /> </authorization> </system.web>
with
<location path="." inheritinchildapplications="false"> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location>
it means - authorization enforced in root app, not child apps.
Comments
Post a Comment