Questions tagged [forms-authentication]

Forms Authentication is a built-in and extensible system for authenticating users in an ASP.Net application that also maintains that authenticated session via a ticket (often stored as a cookie or query string parameter).

Forms authentication uses an authentication ticket that is created when a user logs on to a site, and then it tracks the user throughout the site. The forms authentication ticket is usually contained inside a cookie. However, ASP.NET version 2.0 supports cookieless forms authentication, which results in the ticket being passed in a query string.

Source from : Form authentication microsoft

3189 questions
660
votes
9 answers

ASP.NET MVC - Set custom IIdentity or IPrincipal

I need to do something fairly simple: in my ASP.NET MVC application, I want to set a custom IIdentity / IPrincipal. Whichever is easier / more suitable. I want to extend the default so that I can call something like User.Identity.Id and…
Razzie
  • 29,772
  • 11
  • 60
  • 74
273
votes
21 answers

How to get the current user in ASP.NET MVC

In a forms model, I used to get the current logged-in user by: Page.CurrentUser How do I get the current user inside a controller class in ASP.NET MVC?
Serhat Ozgel
  • 22,430
  • 29
  • 98
  • 137
148
votes
23 answers

FormsAuthentication.SignOut() does not log the user out

Smashed my head against this a bit too long. How do I prevent a user from browsing a site's pages after they have been logged out using FormsAuthentication.SignOut? I would expect this to do…
Jason
  • 7,950
  • 9
  • 53
  • 65
96
votes
4 answers

How to redirect to a dynamic login URL in ASP.NET MVC

I'm creating a multi-tenancy web site which hosts pages for clients. The first segment of the URL will be a string which identifies the client, defined in Global.asax using the following URL routing…
90
votes
4 answers

How to check user is "logged in"?

I am using form authentication with below method in my ASP.NET application FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, true); How do I check whether user is logged in or not? And how can I get the user name of a logged in user?
BlueBird
  • 6,855
  • 7
  • 31
  • 58
81
votes
3 answers

what is ASPXAUTH cookie?

While working with ASP.Net Forms Authentication I came across the .ASPXAUTH cookie. I have a couple questions: What is the purpose of this cookie? What is the location of this cookie?
balaweblog
  • 13,736
  • 28
  • 70
  • 93
78
votes
4 answers

Why is included in the following example?

The ? wildcard represents unauthenticated users while * represents all users, authenticated and unauthenticated. My book shows the following example of URL authorization:
71
votes
13 answers

Forms authentication: disable redirect to the login page

I have an application that uses ASP.NET Forms Authentication. For the most part, it's working great, but I'm trying to add support for a simple API via an .ashx file. I want the ashx file to have optional authentication (i.e. if you don't supply an…
Dean Harding
  • 67,567
  • 11
  • 132
  • 174
67
votes
5 answers

Configuring Spring Security 3.x to have multiple entry points

I have been using Spring Security 3.x for handling user authentication for my projects, and so far, it has worked flawlessly. I recently received the requirements for a new project. In this project, it requires 2 sets of user authentication: one to…
limc
  • 36,786
  • 19
  • 95
  • 142
63
votes
2 answers

Can I change the FormsAuthentication cookie name?

Can I change the FormsAuthentication cookie name? If yes, How? The problem which I've got is that when I have two web applications are deployed in the same domain then when anyone is logged in then the second one will be automatically logged out…
French Boy
  • 1,431
  • 2
  • 17
  • 23
62
votes
7 answers

Page.User.Identity.IsAuthenticated still true after FormsAuthentication.SignOut()

I have a page that when you press 'log out' it will redirect to the login.aspx page which has a Page_Load method which calls FormsAuthentication.SignOut(). The master page displays the 'log out' link in the top right of the screen and it displays…
lisburnite
  • 2,270
  • 5
  • 28
  • 56
62
votes
1 answer

How do I use my own database with SimpleMembership and WebSecurity? What is MVC4 security all about?

I've read everything on this topic I could find, including MSDN articles and SO posts, but I'm still very lost and confused. Questions Please answer the following (briefly, if possible): What is SimpleMembership/SimpleMembershipProvider…
56
votes
5 answers

Store/assign roles of authenticated users

I am upgrading a site to use MVC and I am looking for the best way to set up Authentication. At this point, I have the log-in working off of Active Directory: validating a username and password, and then setting the Auth cookie. How do I store the…
Billy Logan
  • 2,713
  • 15
  • 39
  • 48
55
votes
5 answers

ASP.NET MVC Forms Authentication + Authorize Attribute + Simple Roles

I'm trying to add simple Authentication and Authorization to an ASP.NET MVC application. I'm just trying to tack on some added functionality to the basic Forms Authentication (due to simplicity and custom database structure) Assuming this is my…
Kevin
  • 1,653
  • 2
  • 17
  • 16
54
votes
4 answers

How to implement "Stay Logged In" when user login in to the web application

On most websites, when the user is about to provide the username and password to log into the system, there's a checkbox like "Stay logged in". If you check the box, it will keep you logged in across all sessions from the same web browser. How can I…
Thang Pham
  • 35,825
  • 73
  • 192
  • 279
1
2 3
99 100