How to provide Authorization & Authentication using Asp.net, C#? -
i have asp.net application in c#.
i have provide page authorization specific user/usergroup.
i have created 2 tables in database: 1) pagename 2)permissions[insert, update, view, delete]
but i'm unable match tables , permissions assigning...
can 1 please me, how created tables in database , how coding.
please me.
you can below explanation.
configure access specific file , folder, set forms-based authentication.
request page in application redirected logon.aspx automatically.
in web.config
file, type or paste 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
Post a Comment