simplemembership

How to change username using mvc4 and simplemembership [duplicate]

一笑奈何 提交于 2019-12-11 15:09:04
问题 This question already has answers here : Is it possible to change the username with the Membership API (7 answers) Closed 6 years ago . Why is it that you can't change a simplemembership username. I've tried MembershipUser memUser = Membership.GetUser(existingUser); memUser.UserName = model.UserName; Membership.UpdateUser(memUser); I get that MembershipUser.UserName is read only. There are no other available methods for changing the username. Is there a way around this problem? Edit: New

How do you extend the SimpleMembership authentication in ASP.NET MVC4

a 夏天 提交于 2019-12-11 09:43:29
问题 I've done several ASP.NET MVC 1 and 2 sites. Somehow I managed to skip v3. I'm now creating a new ASP.NET MVC 4 site and I see that all the Membership stuff has changed completely. At first I was happy. It looked easy to setup and use and the Internet project template came with all the classes and views I needed to get started. Unfortunately, I'm now completely stuck. I need extend the code that authenticates a user. Basically, I need to authenticate some users against a web service and other

MVC roles with custom properties

岁酱吖の 提交于 2019-12-11 08:32:19
问题 I'm looking into how to implement authorization in MVC 4 (.NET 4.5), and have specifically been reading about SimpleMembership. Is there any typical or accepted way in MVC to have roles that have additional properties aside from a name? For example, suppose you were designing a CMS, and wanted to be able to have a role called something like Writer that let a user make modifications. However, you also want the role to be restrictive to a single page. The only way that I know of to do that

How to access the SimpleMembershipProvider Hashing Algorithm

北城以北 提交于 2019-12-11 06:19:24
问题 Is there a way to use the same hashing algorithm that SimpleMembership uses for password to hash a clear-text password without actually setting or changing a password? I just want the hashed version of the password for comparison. I am building a new site using MVC 4, and have opted to use the SimpleMembershipProvider to handle most account related data. One requirement I have is to keep a password history. I do not need to be able to retrieve the actual passwords, so one-way hashing is fine.

WebSecurity.CurrentUserId = -1

时光总嘲笑我的痴心妄想 提交于 2019-12-11 05:42:05
问题 Im developing an android app that should login/register and read some data from database. I have WebApi login controller. and this is my problem [HttpPost] public HttpResponseMessage Post(Login model) { if (WebSecurity.Login(model.UserName, model.Password)) { int userid = WebSecurity.CurrentUserId;// <- this value is = -1 string name = WebSecurity.CurrentUserName;// <- this value is = "" some query where i need the user id(userid); } else ... } Why after successful login i still have -1 as a

MVC4 Simple Membership with custom database and database first issue

痞子三分冷 提交于 2019-12-11 05:36:39
问题 I am implementing Membership and security in my MVC4 website using custom database. Every things working fine but when I used .EDMX(Designer) to add my database tables membership and security starts giving errors. I also know the reason: This is due to duplicate Class files as default membership use code first approach and I am using database first approach. My question is there is any soluton that I can work using database first(EDMX) and also my security and membership functionality works

MVC4 UserProfiles has no results after logging in

ε祈祈猫儿з 提交于 2019-12-11 05:28:31
问题 On the new MVC4 it uses SimpleMembership which when logging in contains the line: if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)) After this I did the following to get the extended properties I applied to the UserProfile: var context = new UsersContext(); var user = context.UserProfiles.First(n => n.UserName == model.UserName); But UserProfiles has no results and has a count of 0 from context??? There must be something in there as

SimpleMembership Demands App_Data Folder

孤街醉人 提交于 2019-12-11 04:31:40
问题 I'm using SimpleMembership for an ASP.Net MVC 4 application. The connection string is configured to use SQL Server rather than LocalDB in both development and production. That works fine, except that in production, where there is no App_Data folder, SimpleMembership attempts to access App_Data on the first HTTP request to the site after the app pool is recycled (consistently reproducible). For subsequent HTTP requests, it does not attempt to access App_Data. If I pre-create App_Data and grant

IsUserInRole Error with SimpleMembership

拥有回忆 提交于 2019-12-11 03:34:02
问题 I use this codes for Role Authorization on my ASP.NET MVC 4 Internet Application.. @if (Roles.IsUserInRole("RolunAdi")) { <a href="#">Test</a> } It works normally but sometimes I have an error.. It is on the this image.. http://forum.yazgelistir.com/JS/HTMLEditor/Image.aspx?id=593&siteid=0 I have 2 things in my mind.. First; I have two connection string in web.config.. First for entity framework data model, second for SimpleMembership.. (By the way what can I do for use only one connection

MVC Simplemembership I cannot get the userID after logging a user in via OAuth

此生再无相见时 提交于 2019-12-11 01:03:34
问题 So I am in the process of implementing a Facebook login via MVC 4 simplemembership oAuth provider. Registering and signing in the user has worked well. However after signing in a user using oAth, I am unable to get the UserId of the authenticated user. I can see that the UserId exists in the membership_oauth table and it relates to the UserId in the UserProfile table. Normally I would fetch it using WebSecurity.CurrentUserId but there does not seem to be a method for getting this when using