I have created a cookie which contains userID in it..
C#
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
"UserID",
DateTime.Now,
DateTime.MaxValue,
true,
s.EmpID, // userID
FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
// Create the cookie.
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket) {
Expires = ticket.Expiration
});
But the problem is, How can I display An error page stating that Permission Denied when the non admin user accessing admin pages
[Authorize(Roles = "Admin")]