ASP.NET Authentication,Authorization,Principal and Identity objects?
Authentication:
Authentication means identifying the user.Checking weather he is valid person or not.
Authorization:
Authorization means what the rights for the user have .
Sample Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default :
System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
Response.Write("USER NAME :"+ User.Identity.Name + "<br>");
Response.Write("USER AUTHENTICATIOMN
TYPE :" + User.Identity.AuthenticationType + "<br>");
Response.Write("IS HE AUTHENTICATED
:" + User.Identity.IsAuthenticated + "<br>");
Response.Write("IS HE ADMINISTRATOR
:" + User.IsInRole("Administrators")
+ "<br>");
}
}