This project is read-only.

FBA: User without membership provider prefix?

Topics: Internet/Extranet Edition
Sep 29, 2008 at 10:29 AM

Just a small question as I am getting into the FBA code.

In MemberShipRequest.cs, where the web.Group[...].AddUser method is called - can I change the string "{0}:{1}" with the placeholders, so as to add the user without the membership provider prefix? I guess I would also have to change something in Membership.CreateUser - but I'm new to this and don't see what and where to change this (and is it possible at all?). Any help appreciated, of course.

Here the line of code I'm talking about:
web.Groups[request.DefaultGroup].AddUser(string.Format("{0}:{1}", System.Web.Security.Membership.Provider.Name.ToLower(), request.UserName.ToLower()), request.UserEmail, request.FirstName + " " + request.LastName, "Self Registration");
Sep 29, 2008 at 10:36 AM
Edited Sep 29, 2008 at 10:42 AM
Hi Magganpice,

Well, you can drop that but, it won't get you very far. Basically the database can be used by more than one application "App1:bob" "App2:bob" etc. Your provider will store the user in the database when it was created by prepending "app:" or "providerdb:" etc whatever its called in your config.  I'm assuming that you don't like it showing as something:username in SharePoint but that its why you can change those in sharepoint (display name etc). The user name can not be altered because the login routine will provide the username including the "app:" and thats what the SharePoint groups will have to match. 


 request.FirstName + " " + request.LastName is the display name you should be seeing. You don't see it like that in the FBA user manager though, you see the actual usernames including the provider, at in that code you can alter the display but actions when you click to say, edit the user would need to pass the correct user. I believe I started to edit this some time ago since there are inconsistancies there.