FAQ Database Discussion Community


How to get user profile data from ASP.NET MVC custom IdentityUser Model?

c#,asp.net,asp.net-mvc,asp.net-membership,asp.net-identity
With the help of this blog, I have added a custom profile property OfficeKey to ApplicationUser class (in IdentityModels.cs file): public class ApplicationUser : IdentityUser { public int OfficeKey { get; set; } //remaining code here } I can get user name like this: User.Identity.Name How do I get custom...

How to use user.context object for CRM Users in ASP.NET MVC

asp.net,asp.net-membership,asp.net-roles
I'm consuming a WCF Webservice with CRM Backend. All the users are stored in CRM. User can have different roles e.g. Supervisor, Team Leader etc. I would like to use the asp.net User.Identity.Name or User.IsInRole etc. Could someone please advise how this can be achieved?...

Linq members with profiles

asp.net,asp.net-membership,asp.net-profiles
I am trying to make a linq query to pull all users in the membership with their profiles. Here is what I have gotten already: Dim Mbrs = Membership.GetAllUsers Dim Pros = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All) Dim q = From mem In Mbrs Join pro In Pros On mem.UserName Equals pro.UserName Select mem.email,...

ASP.NET Register Control CreatedUser Event (Acting like it worked but no users are in my database)

c#,asp.net,.net,asp.net-membership
I'm trying to create a custom profile object after the registration of a new user. The problem I'm having is that the user registration control does not seem to be storing to my database. When I do the following: protected void RegisterUser_CreatedUser(object sender, EventArgs e) { FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie...

Get Roles with UserId

c#,asp.net,asp.net-membership
Is there a way to get all the roles a user is in using their UserId (uniqueidentifier)? I know that I can use Roles.GetRolesForUser(string username), but I don't have the username at that point, but do have the UserId. I could get the username, but was hoping I could circumvent...

Adding a table to the Membership-database

c#,sql,asp.net-membership
I am using the membership-database for usermanagement. The layout looks as follows: As you can see I added a new table "Downloads". In this table I want to store some additional information. I made a class: public class DownloadInformation { public int Id { get; set;} public int UserId {...

quickest way to implement .net authentication in Web Forms with Entity Framework 6

webforms,asp.net-membership,entity-framework-6,claims-based-identity
I have been checking resources to implement authentication in my web forms application built with entity framework. All examples I found are MVC-related. I have used regular Asp.Net Membership framework a long time before I began to use EF. However, I could not find Membership implementation with Entity Framework code-first....

requiresQuestionAndAnswer set to false in web.config but RequiresQuestionAndAnswer is true at runtime

c#,asp.net,web-config,asp.net-membership,sqlmembershipprovider
In an ASP.net web application I have defined the following Membership provider in the web.config: <membership> <providers> <add connectionStringName="MyServer" name="MyServer" type="System.Web.Security.SqlMembershipProvider" enablePasswordReset="true" requiresQuestionAndAnswer="false" enablePasswordRetrieval="false" /> </providers> </membership> When I run the application in the debugger, the property Membership.Provider.RequiresQuestionAndAnswer is true. Why? And how can I fix this? Update: Ar tuntime,...

Asp.net MVC 5 can't get user roles

asp.net,asp.net-mvc,asp.net-membership,asp.net-identity
I'm trying to get user roles and modify it. I've tried many ways to get user roles but nothing works. Is there anything missing? I can get right User entity but Roles is always null. Is there any way to do it correctly? Thanks var user = UserManager.Users.Single(u=>u.Id==id); var roles...

ASP.NET MembershipProvider membership info (usernames, passwords) not being stored? How would I implement this system in a networked environment?

asp.net,asp.net-mvc,asp.net-membership,membership-provider
I am working on a project in ASP.NET using MembershipProvider for my login system. Our issue is that the ASPNETDB file generated by ASP.NET upon creation of the login system seems to be empty or is not properly storing member information. Our project is a Web Site project, and we...

Membership for external users in Sitecore 8

asp.net-mvc-5,sitecore,asp.net-membership,sitecore8
I want to build a user registration store for Sitecore 8 website. The users will go in an external database. Sitecore.NET 8.0 (rev. 150223) .NET Framework 4.0.30319.18052 Razor Version=3.0.0.0 MVC 5.2.3.0 Asp.net MVC comes with the membership built in (AccountController, views, etc). I wanted to port this to my Sitecore...

Membership not working with Azure SQL database-level firewall

asp.net,azure,asp.net-membership,sql-azure,firewall
We have an Azure Cloud application which stores user login (Membership) info into an Azure SQL database. We have several versions of this database, one for production and one for development. We want our development database to be open to the world and the production limited to Azure cloud applications....

Catching exceptions in async code called synchronously

c#,.net,exception,asynchronous,asp.net-membership
I have thrift service for authentication. catch (AccountNotFoundException) doesn't catch the exception unless I call it in Task.Run. The strange thing is that test case is fine. Why? Is it because task.start() is on the different level than catch? public override string GetUserNameByEmail(string email) { var task = client.GetUserByEmail(email, false);...

Update user's membership role

c#,asp.net,asp.net-membership
I am using asp.net MVC 5 identity 2.0 The administrator is able to change user’s role but used must re-log to see the changes. First thought was to re-log user manually but I failed. After that I thought of dynamically changing user’s role or something else. Could you provide me...

MVC 5 seeding users only works for email

asp.net-mvc,asp.net-membership,asp.net-mvc-5.2
I am working on a porject built on MVC5 and EF Code First. I have multiple contexts, but the one I'm concered about here is the ApplicationDbContext which has the following configuration code: namespace DX.DAL.Migrations.ApplicationDbMigrations { public class Configuration : DbMigrationsConfiguration<ApplicationDbContext> { public Configuration() { AutomaticMigrationsEnabled = false; MigrationsDirectory =...

asp.net identity tables location

c#,asp.net-mvc,asp.net-mvc-5,asp.net-membership,asp.net-identity
I'm working on mvc5 project which is using asp.net identity for membership provider. Now, I've registered the first test user via web interface and I was expecting to see newly created tables in the db I'm using but there are no new tables created although I'm able to register/login/logout of...

Adding some fields in existing membership method

c#,asp.net,asp.net-mvc,asp.net-mvc-4,asp.net-membership
How I can add a product id in asp.net membership with existing method of create user or something like that. Need following thing with membership like that >> Membership.CreateUser(Username, Password , Product id ( need a method to add it )) Roles.AddUserToRole(Username, "some roles") Samemethod.add(username, productid)[ addition for adding the...

Dotnet open auth with Facebook and Email/Password login with aspnet_membership tables

oauth,asp.net-membership,dotnetopenauth
I'm building my first mobile app in which users can login. My app talks to webservices on my site's backend. Users can login/register via either Facebook or an email/password combination In both cases (upon registration) I add user data to the aspnet_membership tables, in case of a Facebook registration the...