---
title: "Forms Authentication and Authorization"  
description: "Forms Authentication and Authorization"  
author: "Anonymous User"  
published: 2011-09-20  
updated: 2011-09-20  
canonical: https://www.mindstick.com/forum/311/forms-authentication-and-authorization  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Forms Authentication and Authorization

How to use [Forms](https://www.mindstick.com/interview/34192/what-is-the-purpose-of-the-authentication-mode-forms-element-in-web-config) [Authentication and Authorization](https://www.mindstick.com/forum/365/authentication-and-authorization-in-asp-dot-net-mvc) in [ASP.NET](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder)?

## Replies

### Reply by Anonymous User

Thanks Rohit for answering me.

### Reply by Chris Anderson

In order to acheive your result first you have to write the some code in web.config file:

<system.web>\
<[authentication](https://www.mindstick.com/blog/177/authentication-and-authorization-in-asp-dot-net) mode="Forms">\
<forms loginUrl="login.aspx" defaultUrl="Employee.aspx" />\
</authentication>

<authorization>\
<allow users="aaa"/>\
<allow users="bbb"/>\
<deny users="*"/>\
</authorization>\
</system.web>

Then you have to authenticate and authorized the user based on the user available in authorization part:

string strId = Login1.UserName;\
string strPass = Login1.Password;\
if (strId == "aaa" && strPass == "aaa")\
FormsAuthentication.RedirectFromLoginPage(strId, false);\
else\
Login1.FailureText = "Invalid ID or Password";

Thanks.


---

Original Source: https://www.mindstick.com/forum/311/forms-authentication-and-authorization

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
