simplemembership

How to Populate Custom Properties Tables When Using SimpleMembership in ASP.NET MVC 4

谁说我不能喝 提交于 2019-12-08 08:12:19
问题 I started working on a MVC project which has 3 types of users (customers, service providers, and administrators) with different specific properties. I'd like to extend the default SimpleMembership implementation in ASP.NET MVC Web Application Internet Application template in Visual Studio 2012. I have the Customer class (not sure about the Key attribute and the relationship) public class Customer { [Key] public string UserName { get; set; } public string FirstName { get; set; } public string

Cannot seed Users & Roles

北慕城南 提交于 2019-12-07 19:03:23
问题 I am trying to seed users and roles into my database. Currently using Code First Entity Framework with Automatic Migrations in C# MVC4. Whenever I call Update-Database -Force I get the following error: Running Seed method. System.InvalidOperationException: You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class. This call should be placed in an _AppStart.cshtml file in the root of your site. at WebMatrix.WebData

ASP.NET login does not redirect just logged user properly in Firefox and IE, but works with Chrome

六月ゝ 毕业季﹏ 提交于 2019-12-07 17:20:30
问题 I have ASP.NET application, which is perfectly works on development environment. Login works on Firefox, IE and Chrome. Requests in Firefox in development env looks like: POST Request: POST /MyServiceName/Account/Login?ReturnUrl=%2FMyServiceName%2F HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate

What encryption does MVC4 use?

Deadly 提交于 2019-12-07 15:31:15
问题 How do we find out what encryption MVC4 uses? I notice there is an option for a SALT but this also seems not to be used in the WebSecurity() module. I would like to know the standard used and if it is easily possible to upgrade to the latest SHA 回答1: According to the below link the Default Hashing Algorithm Is Now HMACSHA256 : http://www.asp.net/whitepapers/aspnet4/breaking-changes Default Hashing Algorithm Is Now HMACSHA256 ASP.NET uses both encryption and hashing algorithms to help secure

How do I manually “log a user in” using WebSecurity + SimpleMembership?

≯℡__Kan透↙ 提交于 2019-12-07 06:51:42
问题 I'd like to use WebSecurity+SimpleMembership, but implement the ability to (optionally) login users via a custom/alternative authentication method. WebSecurity.Login only has one method signature, which requires both a username and a password. I'd like to skip the password check, e.g.: if (MyCustomAuthenticationMethod.Authenticate(username, customData)) { WebSecurity.Login(username); // Login without password check, method doesn't exist though } I assume custom-auth-methods are possible given

ASP.NET Identity external authentication provider custom icon

岁酱吖の 提交于 2019-12-07 05:19:35
问题 With SimpleMembership you can add an icon to the external authentication provider buttons like this: SimpleMembership: Dictionary<string, object> FacebooksocialData = new Dictionary<string, object>(); FacebooksocialData.Add("Icon", "/content/images/gui/loginFacebook.png"); OAuthWebSecurity.RegisterFacebookClient( appId: "x", appSecret: "x", displayName: "Facebook", extraData: FacebooksocialData); And then display them like this in your view: @foreach (AuthenticationClientData p in Model) {

ASP.NET MVC 4 How to manage userid and user content inside controllers

孤者浪人 提交于 2019-12-06 16:00:33
问题 To learn the ASP.NET MVC 4 patter I'm developing and application that has to manage some data and user content. This is the database: public DbSet<UserProfile> UserProfiles { get; set; } public DbSet<Fund> Funds { get; set; } public DbSet<Source> Sources { get; set; } public DbSet<Portfolio> Portfolios { get; set; } public DbSet<Quote> Quotes { get; set; } public DbSet<Deposit> Deposits { get; set; } Where relationship cardinalities are: UserProfile (a user) - Portfolio: 1-N UserProfile -

Using [Authorize] without SimpleMembershipProvider

十年热恋 提交于 2019-12-06 13:55:52
问题 Is there a way to use... [Authorize(Roles: "Administrator")] public class SomeController : Controller { ... } ...with my own Roles database table, without using SimpleMembershipProvider ? My Users and Roles model classes: [Table("Users")] public class UserModel { [Key] public Int32 ID { get; set; } [Required] public String Name { get; set; } [Required] public String Password { get; set; } [Required] public virtual RoleModel Role { get; set; } } [Table("Roles")] public class RoleModel { [Key]

Simple Membership Provider - Entity Framework and Roles

前提是你 提交于 2019-12-06 06:26:36
问题 I'm attempting to use the Simple Membership Provider with MVC 4 as "by the book" as possible. Here is the current scenario: -- I've been using Jon Galloway's blog post on the topic here. 1) I'm aware this thing is wired via Entity Framework. I did notice, however, that when I added properties to the UserProfile class, they didn't appear in the table automatically when it was generated. Is this due to the database already being generated (tables were not present)? I manually added the fields

ASP.NET login does not redirect just logged user properly in Firefox and IE, but works with Chrome

a 夏天 提交于 2019-12-06 05:02:36
I have ASP.NET application, which is perfectly works on development environment. Login works on Firefox, IE and Chrome. Requests in Firefox in development env looks like: POST Request: POST /MyServiceName/Account/Login?ReturnUrl=%2FMyServiceName%2F HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://localhost/MyServiceName/Account/Login?ReturnUrl=%2fMyServiceName%2f Content-Type: