asp.net-membership

Asp.net Memebership Authorization without password

允我心安 提交于 2019-12-19 07:06:12
问题 To authanticate users in Asp.net Membership we can call method FormsAuthentication.Authenticate(username, password) how can I do the same job (generate session, cookies and all other staff that Authanticate does) without users password? I'm trying to login user over facebook connect. User's facebook id is stored within the users data. User should be signed in like a normal user. 回答1: I think you can use the SetAuthCookie method. more info here http://msdn.microsoft.com/en-us/library/system

How would you use Entity Framework (1.0) with ASP.Net Membership?

白昼怎懂夜的黑 提交于 2019-12-19 05:54:40
问题 I'm trying to design an entity model for an application that uses ASP.Net membership for it's user authentication. In most of the database schemas I create, records typically end up related to users via the UserId field on the aspnet_users table. That's worked fine for me in the past, but now that I'm using EF, I'm having some conceptual issues with figuring out how I'm going to reference the user from an entity. For example, let's say we have a "post" entity that contains a "postedBy"

HandleUnauthorizedRequest not overriding

佐手、 提交于 2019-12-19 05:23:46
问题 In my asp.net mvc3 application, I have a custom Authorization Attribute as seen below. public class CustomAuthorize : AuthorizeAttribute { public IAccountRepository AccountRepository { get; set; } public CustomAuthorize() { this.AccountRepository = new UserModel(); } protected override bool AuthorizeCore(HttpContextBase httpContext) { base.AuthorizeCore(httpContext); return AccountRepository.isEnabled(HttpContext.Current.User.Identity.Name); } protected override void HandleUnauthorizedRequest

How? Encrypt and Decrypt user membership passwords in ASP.NET

拜拜、爱过 提交于 2019-12-18 23:48:51
问题 We are creating a new site using ASP.NET membership provider for user registration and log in. Our old system encrypted user passwords so that we could recover them if we needed to. I am having a great deal of trouble figuring out if it is possible to use ASP.NET membership functions to simply encrypt the password when the user registers and then unencrypt it so I can see it. Documentation for this is neigh non-existant. I know how to configure Web.config to have it store passwords as

Normalization of Strings With String.ToUpperInvariant()

馋奶兔 提交于 2019-12-18 15:30:25
问题 I am currently storing normalized versions of strings in my SQL Server database in lower case. For example, in my Users table, I have a UserName and a LoweredUserName field. Depending on the context, I either use T-SQL's LOWER() function or C#'s String.ToLower() method to generate the lower case version of the user name to fill the LoweredUserName field. According to Microsoft's guidelines and Visual Studio's code analysis rule CA1308, I should be using C#'s String.ToUpperInvariant() instead

Normalization of Strings With String.ToUpperInvariant()

大憨熊 提交于 2019-12-18 15:29:24
问题 I am currently storing normalized versions of strings in my SQL Server database in lower case. For example, in my Users table, I have a UserName and a LoweredUserName field. Depending on the context, I either use T-SQL's LOWER() function or C#'s String.ToLower() method to generate the lower case version of the user name to fill the LoweredUserName field. According to Microsoft's guidelines and Visual Studio's code analysis rule CA1308, I should be using C#'s String.ToUpperInvariant() instead

Membership.ValidateUser always returns false after upgrade to VS 2010 / .NET 4.0

拈花ヽ惹草 提交于 2019-12-18 12:40:52
问题 Not sure whether this pertains to VS 2010 or to the upgraded framework, but... we are using the Oracle membership provider to authenticate users. Prior to the upgrade everything worked fine, but now Membership.ValidateUser(user, password) returns false despite valid credentials. There is no exception thrown, so it's hard to determine what the problem might be. The website administration tool in VS 2010 is still able to manage users and roles (more or less), so I have no reason to question

adding more fields to registration form using membership on MySql and MVC 3

牧云@^-^@ 提交于 2019-12-18 12:35:04
问题 i started a site based on asp.net MVC 3 and MySql i got the membership to work with the MySQL .NET connector so with the default application you get with a new project of mvc 3 i have a working register form and a working login form but... how do i add more fields to the registration form? i know how to add them my model and to the page.. but how do i make the membership keep this new data ill get for the user? will i have to make the columns in the database by myself? or does membership

FormsAuthentication Roles without Membership

浪子不回头ぞ 提交于 2019-12-18 12:28:33
问题 I'm trying to use FormsAuthentication and it's working fine at the moment with user name and password. I need to add User Role to the Forms authentication Ticket and i'm not using ASP.NET Membership. if (rep.CheckUser(model.UserName, model.Password,out UserRole))//Check User { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); // Roles.AddUserToRole(model.UserName, UserRole);//This Requires Membership return Redirect(FormsAuthentication.DefaultUrl); } 回答1:

ASP.NET MVC 3: How to get User's Role in a Controller Method?

泄露秘密 提交于 2019-12-18 12:24:45
问题 I want to be able to Get a list of roles of the current authenticated user. Filter the data provided to that user based on their role. I see ways to check if the user is in a particular role, but I don't care what role they participate. The database will know what roles are allowed to see what data. I need to submit a collection of these roles to the data service to filter the data based on those roles. So first step is how do I get all roles associated with the current user in a controller