asp.net-membership

Profiles content check if set?

落爺英雄遲暮 提交于 2019-12-06 15:18:01
Using asp.net profiles, I've stored a complex type (class) and retrieved it. But it is returning a new object that is not initialized instead of null? Is this the expected behavior, if so how can I determine if I've saved data for the given user? should be some easy points for someone to pick up.. Your question is a little unclear, but I think you're asking why there's a non-null profile data object for a user who you haven't stored data for yet? This article might hopefully clear it up for you. Some of the relevant bits: A user profile is a collection of values that the ASP.NET 2.0 runtime

ASP.NET password hashing and password salt

我是研究僧i 提交于 2019-12-06 14:51:51
问题 I'm creating a custom "add user" page in ASP.Net web forms and have hit a problem. I can insert all the data into the membership table but the passwords are stored in plain text and the password salt has been hardcoded. How do i go about hashing the passwords so that users can log in (as the membership framework checks for a password hash and not a clear text password). Also, is the salt completely random or is it linked to the password hash somehow? Any help would be greatly appreciated,

.NET MVC 3 (C#) default membership provider - how to set up?

跟風遠走 提交于 2019-12-06 12:37:08
I'm somewhat confused by membership providers for .NET. I have built a MVC 3 web application, but obviously login pages don't work out-of-the-box because I need to wire up a membership provider. I would have expected this process to be easy, but when I search for help I find numerous articles on writing custom providers. Can't I just set up a table or two, wire up a few details in web.config and have things work based on some default MVC membership provider? I have no desire to re-invent the wheel! TIA. The MSDN membership installation documentation is still applicable through to .NET 4,

ASP.NET membership get UserId of anonymous user

别等时光非礼了梦想. 提交于 2019-12-06 12:04:30
I have an existing project that i'm working on that uses .net membership. We want to expand the project to allow anonymous users but we seem to have hit a snag as we use the UserId of the aspnet_Users table as a foreign key in many of our database tables. The following call returns null as there is no record in the aspnet_Membership table for anonymous users Membership.Provider.GetUser(Request.AnonymousID, false); Is there any way to get the UserId of an anonymous user through the standard API's? or will I have to write an extension that can do it? As far as I know it is about access. If your

How can I reference my own table with the MVC Controller.User property?

笑着哭i 提交于 2019-12-06 11:30:05
With the default membership provider for MVC 2 projects, I can reference User.Identity.UserName as per whatever it creates by default. I don't want to do this--want to use my own tables. So, I implemented the System.Web.Security.MembershipProvider class. The only thing I've implemented, as per many posts on the web and SO, is ValidateUser(string username, string password) I can easily see this accepts username and password strings, I access my database context (LINQ to Entities, actually the dotConnect provider for MySQL), and check the username and password--simple enough. But, how can I make

Avoid concurrent login (logout former login session) in ASP.net membership

霸气de小男生 提交于 2019-12-06 11:24:58
问题 I am learning the ASP.net membership feature. I am wondering how I can implement so that later login session logout former login session to avoid concurrent login. I know how to check whether the user is online (by Membership.IsOnline()) and logout the current user (by FormsAuthentication.SignOut()). But I don't know how to logout the previous login session. Any code or reference that I can read? 回答1: I don't think there is an explicit way to do this. One way to implement it would be to store

List of online users using membership asp.net

爷,独闯天下 提交于 2019-12-06 11:20:58
I want to have a list that contains online users in my web site i use this code in local host but it did't shows me any user. Can any body help me? where did i make mistake? MembershipUserCollection users; if (!IsPostBack) { // Bind users to ListBox. List<MembershipUser> onlineUsers = new List<MembershipUser>(); foreach (MembershipUser user in Membership.GetAllUsers()) { if (user.IsOnline) { onlineUsers.Add(user); } } ListBox1.DataSource = users; ListBox1.DataBind(); Try changing this line: ListBox1.DataSource = users; To this: ListBox1.DataSource = onlineUsers; Also do not forget to set the

ASP.NET MVC Membership Roles

半城伤御伤魂 提交于 2019-12-06 11:19:44
I need some clarifications for ASP.NET Membership; please help me with it. I am using ASP.NET MCV 3 framework and intending to use ASP.NET Membership for users & authentication management using either LDAP or SQL. For what I've understood until now; ASP.NET Membership is: [User] has [Role] or [Role] has [Users] But in my project I have a more complex business logic; where I need this hierarchy to next level like [User] has [Role] -> has [Tasks] So I can dynamically assign/revoke tasks/permissions to my MVC controllers or actions; I plan to get started with Membership with SQL Provider and than

MVC3 - Where is UserId and Roles information

走远了吗. 提交于 2019-12-06 11:08:16
This is the Model code generated in MVC3 for Account/Membership class for a sample project I created. I do not see UserId field/attribute or Roles information.. Where is the UserId and Roles information ? public class ChangePasswordModel { [Required] [DataType(DataType.Password)] [Display(Name = "Current password")] public string OldPassword { get; set; } [Required] [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "New password")] public string NewPassword { get; set; } [DataType(DataType

MVC 4 Add Profile Image to RegisterModel

混江龙づ霸主 提交于 2019-12-06 11:06:19
How do you add the option to upload a profile image to the default RegisterModel in MVC 4? This answer converts the image to a byte array so that you can then save it in a database. It can easily be modified if you wanted to save the image to file store. The code for the View Model. The important part is the multipart/form-data attribute: @using (Html.BeginForm("Register", "Account", null, FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.AntiForgeryToken() @Html.ValidationSummary() <fieldset> <legend>Registration Form</legend> <ol> <li> @Html.LabelFor(m => m.UserName) @Html