simplemembership

Membership.DeleteUser is not deleting all related rows of the user

柔情痞子 提交于 2019-12-22 10:31:19
问题 Membership.DeleteUser() manages to delete the userprofile of the user I am deleting. Why does it not also delete it's information stored in webpages_membership . I am not using roles at this point in time so keep that in mind for your answers. 回答1: I ran a test and verified that SimpleMembershipProvider.DeleteUser does not work as advertised. According to the documentation: This method deletes the entry in the membership account table (by default, webpages_Membership ). If

MVC Code First: One-to-many relationship between own model and SimpleMembership user

我怕爱的太早我们不能终老 提交于 2019-12-22 09:07:44
问题 I am currently working on an event calendar website and I am still a novice when it comes to ASP.NET. I am using the MVC4 Framework, as well as the EntityFramework (CodeFirst) and the SimpleMembershipProvider, which comes with the MVC4 template. I am also using Migrations - If that is from any interest. What I've got so far I do currently have two models, with a one-to-many relationship, which work just fine: _Events.cs (had to name it that way, because event is reserved) public class _Event

Simplemembership - adding email field and use as login-name

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 19:28:25
问题 I am trying to do two things here: 1. Adding an email field to the (default)UserProfile table. Works like a charm. Users can register both a username and email. 2. Change the login to use the email instead of username, this does also works like a charm. Here is the problem. The above only works when i seperate them, as soon as I use both of them the registration process fails with the following error message: Cannot insert the value NULL into column 'UserName', table 'opdb.dbo.UserProfile';

Why Claim based authentication instead of role based authentication

不羁的心 提交于 2019-12-21 07:14:39
问题 I am new to claim based authentication. I have gone throught several aricles and could not able to figure out the exact use of claim based authentication. Here are some doubts I have about claim based authentication. I would like to know what is the difference and advantages of claim based over role based authentication. Can we connect to Sql Server 2008 R2 using claim based authentication instead of ADFS? If, so how? Advantage of using claim based authentication in WCF? Can anyone provide me

ASP.NET simple membership provider?

无人久伴 提交于 2019-12-20 11:36:09
问题 I opened Asp.Net Mvc 4 Internet App. template. And I set connection string for my database like this: <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=ALI-PC\;Initial Catalog=OsosPlusDb;Persist Security Info=True;User ID=sa;Password=sa;" providerName="System.Data.SqlClient" /> </connectionStrings> I run project, click register button. I created a new user like this: When I click register to post I get this error: But it creates a new user in DB and it does not

SimpleMemership CreateUserAndAccount Customization

两盒软妹~` 提交于 2019-12-20 10:23:15
问题 I am trying to add a new property to the UserProfile class in my model public class UserProfile { [Key] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int UserId { get; set; } public string UserName { get; set; } [Required] [DataType(DataType.EmailAddress)] [Display(Name = "Email Address")] public string Email { get; set; } \\this is the new property public virtual IList<Game> Games { get; set; } } I am trying to add it to my seed method in my Configurations.cs file

A Custom Membership Provider *Without* a Database?

落花浮王杯 提交于 2019-12-20 06:07:11
问题 I've been looking around various SO questions, blog posts, and so forth regarding the changes to membership providers in MVC 4. While I like many of the changes and the simplification of things (particularly the out-of-the-box external login support), I'm as yet unable to find one seemingly-simple thing... How can I override the membership/role provider with a custom one that uses another data source? I don't want to replace WebSecurity or anything that drastic, since it handles all of the

How to check user is in many roles in asp.net identity

梦想与她 提交于 2019-12-18 09:15:52
问题 Hi I need to check if a user is in one of the roles and i am confused with different versions of code that i found. Let me show you what i have at the moment first _manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>()); var currentUser = _manager.FindById(User.Identity.GetUserId()); if (!_manager.IsInRole(currentUser.Id, "admin")) { } And ApplicationUser public class ApplicationUser : IdentityUser { } public class ApplicationDbContext : IdentityDbContext<ApplicationUser

How am I supposed to use ReturnUrl = ViewBag.ReturnUrl in MVC 4

ε祈祈猫儿з 提交于 2019-12-17 15:27:34
问题 I'm working on 'ASP.NET MVC 4' application. I'm using/learning SimpleMembershipProvider and try to stick to the default logic created by VS2012 with the Internet template (if I'm not mistaken, the one with 'SimpleMembershipProvider' out of the box). I'm stuck at the AccountController where I just can't figure put how exactly I can use this method: private ActionResult RedirectToLocal(string returnUrl) { if (Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } else { return

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

南笙酒味 提交于 2019-12-17 06:21:43
问题 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 ( WebMatrix.WebData ) and what is it/are they responsible for? What is WebSecurity ( WebMatrix.WebData )? What is the Membership ( System.Web.Security ) class? Why does MVC4 create a UserProfile table and a webpages_Membership table? What are they for and what