Explain Authentication and Authorization in asp.net with good examples?

Posted by Sivakumar.S under ASP.NET on 8/14/2012 | Points: 10 | Views : 5270 | Status : [Member] | Replies : 3
Hi All,

Can anyone explain Authentication and Authorization in asp.net and its types with good examples..

Thanks in Advance.

siva


Responses

Posted by: Ranjeet_8 on: 8/14/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Refer this url.
This article will help u to understand authentication-and-authorization.
http://www.dotnetfunda.com/articles/article979-aspnet-authentication-and-authorization.aspx

.

Sivakumar.S, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/14/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
@Sivakumar.S
Please Mark As Answer, if above post helps u.

Sivakumar.S, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: GSM_GSV on: 8/14/2012 [Member] Starter | Points: 25

Up
0
Down
Authentication
Suppose, consider you logged into a site by entering username and password.
http://www.example.com/login.aspx

Now, you will be redirected to home page after authenticating username and password from the database.
http://www.example.com/Home.aspx

So, what happens if any other user paste the home page URL in his browser? obviously, he will get the home page screen, when Authentication is not used.
Rather, if authentication is used, he will be redirected to login page with the return URL

Authorization
Consider you are the admin, and want to monitor the invalid login attempts of other users.
So, in this case, you will create pages like admin.aspx, login.aspx and home.aspx
consider some pages Ex: admin.aspx will be in Admin folder.
Now, you register admin. user and grant admin role
So when you login with admin credentials, you will be redirected to admin page.
Similarly, normal users will be redirected to home page, but they cannot access admin page, because they are not authorized to view admin page.
The pages outside the admin folder are accessible to all users who are successfully logged in.
And the pages inside admin folder are accessible only to admin, since that folder has only admin role.

To understand this concept clearly, do, workout with whatever example I have given.
Note: I suggest you to use web administration tool for granting roles, etc.

---------------------------------------
Live the life you've dreamed

Regards
MADHU

Sivakumar.S, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response