How to use Authorization & Authentication in Asp.net, C#? -


i using roll management , trying give page , folder access according user or user group, using server created ad group user authentication.

i have default1.aspx page default , subdir1 folder give different access separate user group

i using below logic in web.config.

<location path="subdir1">     <system.web>         <authorization>             <allow users ="?" />         </authorization>     </system.web> </location> 

i facing problem provide same access 2 or more directory same user should have provide allow user code twice both folder?

i can use logic repeating value folder want access providing in 1 logic.

i have got answer configure folder/page access, have make different access shown below..

configure access specific file , folder, set forms-based authentication. request page in application redirected logon.aspx automatically.

in web.config file, done following code.

this code grants users access default1.aspx page , subdir1 folder.

<configuration>     <system.web>         <authentication mode="forms" >             <forms loginurl="login.aspx" name=".aspnetauth" protection="none" path="/" timeout="20" >             </forms>         </authentication> <!-- section denies access files in application except have not explicitly specified using setting. -->         <authorization>             <deny users="?" />          </authorization>     </system.web> <!-- section gives unauthenticated user access default1.aspx page only. located in same folder configuration file. -->         <location path="default1.aspx">         <system.web>         <authorization>             <allow users ="*" />         </authorization>         </system.web>         </location> <!-- section gives unauthenticated user access of files stored in subdir1 folder.  -->         <location path="subdir1">         <system.web>         <authorization>             <allow users ="*" />         </authorization>         </system.web>         </location> </configuration> 

users can open default1.aspx file or other file saved in subdir1 folder in application. not redirected automatically logon.aspx file authentication.

repeat configuration step identify other pages or folders want permit access unauthenticated users.

for more reference check microsoft support page - https://support.microsoft.com/en-us/kb/301240

and can check http://www.iis.net/configreference/system.webserver/security/authorization

after have coding on login page reference check -> http://www.codeproject.com/articles/13872/form-authentication-and-authorization-in-asp-net


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -