membership-provider

Ensuring only one user login using ASP.Net Membership Provider

£可爱£侵袭症+ 提交于 2019-12-10 11:45:25
问题 How would you ensure that only one user is logged in per account at a time? Assuming cookies are persistent. 回答1: Typically the best way is to implement a customization on the provider that checks for last login, as well as adding methods to your code to keep track of user action. The key is that you must know at what point did the user last do something OR logout. From there you can determine if the account is actually ready. If you setup the tracking for these elements in code, You can then

Get the ID of the current user ASP.NET Membership

孤街醉人 提交于 2019-12-09 05:25:15
问题 How do you guys manage to get the ID of the current user using the ASP.NET Membership Provider? My application is an MVC 3 using Database First approach, so I created my own database and the Membership Provider and Role Provider are using my tables (Custom Membership and Role Provider). In one of my page (feedback), user can send feedback about my website and if he's connected, I want to include the UserID in the table when I insert. But since the ASP.NET Membership is an IIdentity, the only

Host custom WCF service with authentication within Umbraco

不羁的心 提交于 2019-12-08 13:58:26
I've created a custom WCF service within Umbraco. The service resides in the Service folder and seems to be working fine (I can call it and it responds appropriately). Now I want the users to authenticate themselves when they call the service. To do this I've added these lines into the web.config : <system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> <bindings> <webHttpBinding> <binding name="RaceManBinding"> <security mode="None" /> </binding> </webHttpBinding> </bindings> <services> <service name="RaceManagerAdmin

General rules for when to use which types of memberships in MVC

假装没事ソ 提交于 2019-12-08 13:46:43
问题 Already I have known 3 types of memberships in Microsoft MVC. They are: membershipprovider extendedmembershipprovider simplemembershipprovider Obviously they have differences to use. What is the key advantage for selecting each of them? May somebody describe? Thanks. 回答1: The following post from Jon Galloway goes into great detail explaining what I think it is you are asking. The article includes a class diagram that shows the relationship between all three classes that you have listed. The

StringLength attribute, client side validation and a membership provider

血红的双手。 提交于 2019-12-08 11:19:32
问题 How do I pass a value from Membership Provider (taken from web.config) to Validation Attributes in AccountModels in default MVC 3 project? Membership.MinRequiredPasswordLength returns value obtained from web.config and Register.cshtml view uses it: <p> Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. </p> But it seems that ViewModel in AccountModels file have the values hard-coded in: [Required] [StringLength(100, ErrorMessage = "The {0}

Help implementing simple / custom MembershipProvider

谁都会走 提交于 2019-12-08 10:11:50
问题 I have been follow Steve Sandersons MVC2 book and have implemented a simple / custom MembershipProvider. You will not that a valid user has been hardcoded. My question is how do I get this to validate against my "Profiles" SQLServer table? PS - I am using EF 4.1 Code First Please see below: public class Profile { [Key] public int UserId { get; set; } [Required] public string UserName { get; set; } [Required] public string Password { get; set; } } public class SimpleMembershipProvider :

Why is WebSecurity ignoring my password?

时光怂恿深爱的人放手 提交于 2019-12-08 08:41:03
问题 I have configured SimpleMembership to use my own table for user data, the Occupant table, as follows: WebSecurity.InitializeDatabaseConnection("EstatesContext", "Occupant", "Id", "UserName", autoCreateTables: true); And in the register event, pass data for this table like so: WebSecurity.CreateUserAndAccount( model.UserName, model.Password, propertyValues: new { IdNumber = model.IdNumber, Surname = model.Surname, FirstName = model.FirstName, Type = model.Type, IsActive = model.IsActive,

Extending the RoleProvider GetRolesForUser()

爱⌒轻易说出口 提交于 2019-12-08 08:34:55
问题 The GetRolesForUser() method in the RoleProvider takes the user login name and returns the list of roles for that user. But in my application this is not enough, I need a few more pieces of information to be able to get the user's roles. How can I get this extra information into the method? I have it in the Session , but I found out that Session is not available in the RoleProvider . What I had in mind was putting this extra info in some class that extends MembershipUser , assuming I can get

Host custom WCF service with authentication within Umbraco

前提是你 提交于 2019-12-08 07:20:49
问题 I've created a custom WCF service within Umbraco. The service resides in the Service folder and seems to be working fine (I can call it and it responds appropriately). Now I want the users to authenticate themselves when they call the service. To do this I've added these lines into the web.config : <system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> <bindings> <webHttpBinding> <binding name="RaceManBinding"> <security mode=

C# MembershipUser.ChangePassword fails for one user only?

大城市里の小女人 提交于 2019-12-08 05:56:55
问题 I'm using the change password feature of the standard AspNetSqlMembershipProvider in my ASP.NET MVC-2 app: MembershipUser user = Membership.GetUser(userId); string pwd = user.ResetPassword(); if (user.ChangePassword(pwd, confirmPassword)) { // it worked } And this works for the vast majority of users, but there are a couple of users that can not change their passwords - user.ChangePassword() just returns false. I've tried it myself to see what was going on, and entered a simple password