form-authentication

How to extend aspnet membership forms authentication tables?

烂漫一生 提交于 2019-11-30 05:02:54
问题 I would like to add a realName field in addition to the user's user name and email address. In the past I have created a new table that includes the username and realName columns when a user registers. However I would like to know if it is possible to extend the default asp.net forms authentication membership table or user table (or whatever table is necessary, to add this to) instead of creating a new table for this information. Question: How can i add a new column to authentication tables?

401 Unauthorized: Access is denied due to invalid credentials

让人想犯罪 __ 提交于 2019-11-28 15:28:30
问题 I am using IIS Express to deploy MVC4 application. This website runs perfectly on same computer. But in Lan it gives me error 401. <authentication mode="Forms"> <forms loginUrl="~/" slidingExpiration="true" timeout="20"> </forms> </authentication> In home controller [HttpPost] [AllowAnonymous] public ActionResult Index(LoginModel model, string returnUrl) { } I am starting IIS server from command prompt in Administrator mode. IIS responds to the request with error 401 . Any clue? 回答1: I

How do I log a user out when they close their browser or tab in ASP.NET MVC?

和自甴很熟 提交于 2019-11-27 07:01:43
I need to sign out a user when the user closed the tab or browser, how do I do that in ASP.NET MVC? George Stocker There are a few things you can do to make sure the user is signed out when the browser is closed, but it depends on how you're setting the FormsAuthentication cookie: Use Cookieless=True . Set a FormsAuthenticationTicket to not be persistent Use FormsAuthentication.SetAuthCookie to set Persistence to false Use a JavaScript approach to remove the cookie on window.unload . Cookieless=True approach: <system.web> <authentication mode="Forms"> <forms loginUrl="/Account/Login"