asp.net-membership

Why does Membership.ValidateUser() always return false?

安稳与你 提交于 2019-12-08 10:56:28
问题 I have an ASP.NET 2010 app. When I go through the registraiton process, I correctly get logged in. However, if I just try to log in later, ValidateUser always returns false' blnSuccess = Membership.ValidateUser(strUserName, strPassword) I've stepped through to ensure the correct username & password are being sent in and that this person is in the db (Express). Here's my Web.Config....All just regular stuff. <connectionStrings> <add name="ApplicationServices" connectionString="data source=.

MembershipProvider in .NET for CAS Shibboleth

白昼怎懂夜的黑 提交于 2019-12-08 10:08:53
问题 Is it possible to write a MembershipProvider in .NET for CAS Shibboleth? 回答1: You usually use a custom MembershipProvider when want to change the data source (es from sql to xml). By implementing a MembershipProvider you can override the Providerbase methods and change, for instance, where the Membership will verify if a user exists or where its stores it. So the answer is yes you can, there are a few drawbacks though. Membership in Asp.Net is usually part of the application and should run in

Should I store user data in session or use a custom profile provider?

回眸只為那壹抹淺笑 提交于 2019-12-08 09:58:44
问题 On my site when a user logs I create a session object with the following properties DisplayName, Email, MemberId Questions Would it make more sense to use a custom profile provider for holding user data? What are the pro's and con's of each approach (Session and custom profile provider)? Does it make sense to use a custom provider for read only data that can come from one or more tables? 回答1: My answer is not direct approach to your question. It is just an alternative approach. Instead of

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

MVC3 using routes or using controller logic?

流过昼夜 提交于 2019-12-08 07:37:51
问题 I'm relatively new with MVC3, but I'm using it, C# and EF4 to create an application website. The routing that I'm using is the same as in the default Microsoft project created when I selected MVC3 pattern, nothing special: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter

asp.net MVC 4.0 membership database

戏子无情 提交于 2019-12-08 06:53:05
问题 I'm familiar with aspnet_regsql.exe to create a membership database in asp.net web forms. but i am not aware about MVC4.0(visual studio 2012) membership. what should i do to have these membership table in SQL server management studio 2012. 回答1: The tables are created automatically the first time you try to register a user. If you want to configure a remote database, then you can use database migrations to generate a script to execute to create the tables afterwards. 来源: https://stackoverflow

ASP.NET MVC Custom Membership Provider “CreateUser”

核能气质少年 提交于 2019-12-08 06:37:49
问题 I've implemented some basic, custom membership provider for my ASP.NET MVC application so I thought that all validation will be done in my custom code. Unfortunately when I'm trying to create new user by calling function: Membership.CreateUser(user.UserName, user.Password, user.Email, null, null, true, Guid.NewGuid(), out status); which should eventually throw an exception with all validation errors I'm getting a status like "InvalidUserName" or "InvalidPassword" instead... That means that my

MemberShipException during the User Register at ASP.NET

流过昼夜 提交于 2019-12-08 06:09:27
问题 I'm using the ASP.NET MVC 4 template to create my application, in my method Register POST, i put a block that call the UserProfile and save new information, on this case, it will save UserType . The problem is: Every time that I'll save the user, the exception MembershipCreateUserException is called and the following message is displayed on the page: User name already exists. Please enter a different user name. The User is saved on Database. This is my method Register: public ActionResult

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