asp.net-membership

Extending a Custom Membership Provider

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 04:50:41
问题 I have made a Custom Membership Provider and implemented what methods i need. I now need to add a custom method of my own which deals with the password. I have added a new method but i am unable to use it anywhere in code. Is it possible to add methods to my custom membership provider or is this done elsewhere? 回答1: ((YourProviderType)Membership.Provider).YourMethod(); 来源: https://stackoverflow.com/questions/5741769/extending-a-custom-membership-provider

Adding a custom hashAlgorithmType in C# ASP.NET

扶醉桌前 提交于 2019-12-21 02:54:30
问题 I've got a page that I need to beef up security on. I'm using the built-in MembershipProvider functionality and currently have hashAlgorithmType set to SHA512. I've got the BCrypt.NET library (http://bcrypt.codeplex.com/) and it seems to be working nicely when I call its functions from code but I'm having the worst time figuring out how to create the appropriate <cryptographySettings> section in Web.config to let me create a hashAlgorithmType . I found the following code snippet on the web:

Can you wrap the RolePrincipal in a custom IPrincipal object?

喜夏-厌秋 提交于 2019-12-21 02:41:36
问题 I am using custom Membership and Role providers inside the ASP.NET framework with Forms Authentication. These are working great. The Role provider is using a cookie to persist the roles, saving a trip to the database on each web request. I am also using the UserData string inside the FormsAuthenticationTicket to store the UserId. I need to refactor my DAL out of the web project to its own project. The DAL has a dependency on retrieving the Current user’s ID as well as checking the roles for

MembershipCreateUserException - The username supplied is invalid

守給你的承諾、 提交于 2019-12-20 23:28:33
问题 On this line i am getting an exception - OAuthWebSecurity.CreateOrUpdateAccount(provider, providerUserId, model.UserName); System.Web.Security.MembershipCreateUserException: The username supplied is invalid. The data going into this is provider - "facebook" providerUserId - "1321311387573991" model.UserName - "Max Payne" The initialization works fine using WebSecurity.InitializeDatabaseConnection("club", "User", "UserID", "UserName", autoCreateTables: true); I cannot find any examples of why

Best practice to join nhibernate and ASP.NET membership/role/profile services

不问归期 提交于 2019-12-20 12:25:01
问题 I've got a generic ASP.NET (MVC) application, that uses NHibernate as the model persistence layer, and ASP.NET Membership/role/profile services as the user management layer. The question is what can be considered as the best practice to create linkings between the domain data and the users. (For example is I want to create a forum system I want to link each topics/posts to a specific user, and want to display the user at each request). These are the posiibilites I've been thinking of: Store

Integration of Facebook and asp.net membership

让人想犯罪 __ 提交于 2019-12-20 10:57:36
问题 I want to allow users to sign up to my website using Facebook. I already use the JS SDK on the client side for authentication and authorization and the C# sdk on the server side to get all the information I need to complete the user profile. My issue is that I order to allow the user to login with his facebook account, I need to create a username and password for him in my membership provider. I already decided I'll use the Facebook email as the username, but what can I do about the password?

ASP.Net MVC Hide/Show Menu Items Based On Security

落花浮王杯 提交于 2019-12-20 10:44:18
问题 I'm working on an ASP.Net MVC 3 site. The _Layout master view contains a menu and I want to hide some of the items in the menu based on if you are logged in and what roles you are in. This currently works using code like this @if (HttpContext.Current.User.Identity.IsAuthenticated) { <li id="MyLearningTab">@Html.ActionLink("My Learning", "MyLearning", "Learning")</li> if (HttpContext.Current.User.IsInRole("Reporters")) { <li id="ReportTab">@Html.ActionLink("Reports", "Index", "Reports")</li> }

Extending AccountController: ASP.NET MVC Membership

家住魔仙堡 提交于 2019-12-20 10:13:54
问题 The ASP.NET MVC 1.0 (final) project template has basic membership built in, but I need to extend it in two ways: Email Confirmation to validate new accounts. Additional fields on the registration view, such as "Home Street Address" and "Department Number" I am planning to modify the template files such as Controllers/AccountController.cs and Views/Account/Register.aspx , but really I'm not sure where to start. I have found many articles that somewhat apply (such as this one at aspnet

Simple custom roles for windows authentication in asp. net?

与世无争的帅哥 提交于 2019-12-20 09:02:28
问题 At our company network, the roles in Active Directory(AD) are not appropriately assigned for my application. So I created a simple table in my database mapping all the users in the AD and their roles. There is literally only two columns in this table, user and role. I hope to take advantage of the powerful role management in asp.net, I want to use features like [Authorize(Roles = "Managers")] . is there a simple way to use these custom roles without setting up complicated role and membership

How to initialize database with Entity Framework and Membership tables

久未见 提交于 2019-12-20 08:39:50
问题 I have a MVC4 web application that use Entity Framework 5.0 Code First. In Global.asax.cs I have a bootstrapper that initialize the Entity.Database, force the database to be initialized and initialize the database for the Membership. The code is this one: System.Data.Entity.Database.SetInitializer(new DatabaseContextInitializer()); Database.Initialize(true); WebSecurity.InitializeDatabaseConnection(DEFAULTCONNECTION, "UserProfile", "UserId", "UserName", autoCreateTables: true); The