C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
1
Reply
Steps to achieve Forms Authentication in MVC4
Mansi Gupta
9y
641
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
1. Configure the application to use Forms authentication. Modify web.config -
2. Create login page containing fields to be validated - User name, Password.3. Modify configuration settings to redirect unauthenticated users to login page.
4. If the login is successful, create an authentication ticket for the user (encrypted cookie - persistent or non -persistent) FormsAuthentication.SetAuthCookie(model.UserName, false);This will set 1. HttpContext.User.Identity.Name to current logged in user 2. HttpContext.User.Identity.IsAuthenticated to true
Mansi Gupta
9y
0
Message