Error message - Object reference not set to an instance of an object

Topics: General/Misc.
Nov 10, 2008 at 6:39 PM
We have successfully deployed the FBA tool, however, whenever we go to edit specific users, it gives us this error message - Object reference not set to an instance of an object. I can't seem to find a pattern to this. We have about 50 users and this is happening to 30 of them. It doesn't seem to matter if they are site collection administrators or users with view only access. I get this error from them. I did update the FBA recently with the october release, I'm not sure if that has anything to do with it. Please help as we need to be able to edit the users.
Developer
Nov 11, 2008 at 5:26 AM
Check to see if the ones with the problem are listed in the User Information List.  You can see a view of this list at:

http://ServerName/_catalogs/users/simple.aspx 

Exactly when does the error occur?  When saving the edited user, or when the page opens for editing?  You might need to attach a debugger to find out where exactly the error is.


Regards,
Mike Sharp
Nov 12, 2008 at 12:52 PM
Thanks for the response.
The answer is that yes, all of these users appear in the list. The error occurs after a users is created, if you go back into the admin tool ("_layouts/FBA/Management/UsersDisp.aspx") when you try to edit specific users as soon as the page opens for editing. Some users it works for and they can be edited. The temporary fix is to delete the affected users and readd them, however this is problematic.
Developer
Nov 12, 2008 at 3:09 PM
There's no stack trace, either?  It sounds like it could be in either EditUser.cs or the Membership.GetUser() method is returning null. If the user is not correctly added to the membership database, you might end up with this.  Were any of your users imported (rather than created through normal means?)

There's not a lot of code in the edit user screen when it loads.  The page loads the current  user's properties; maybe something is missing.  I'd check the database for one of the affected users to see if there are values for these:

                    // load user props
                    if (spuser != null)
                    {
                        txtEmail.Text = spuser.Email;
                        txtFullName.Text = spuser.Name;
                    }
                    else
                    {
                        txtEmail.Text = user.Email;
                        txtFullName.Text = user.UserName;
                    }
                    txtUsername.Text = user.UserName;
                    isActive.Checked = user.IsApproved;


spuser and user are retrieved with:

spuser = this.Web.AllUsers[settings.MembershipProvider + ":" + userName];
MembershipUser user = Membership.GetUser(userName);

Basically, if the user has logged into the web site before, they'll show up in Web.AllUsers.  If they've never visited the web site before, they're only going to be in the Membership.  I'm thinking that some of these users might be missing something...

One last area to check is the user's roles, although in the code the role databinding is handled in a try-catch block, and errors are not re-thrown.  So I don't see where this could happen there.

Regards,
Mike Sharp
Dec 5, 2008 at 2:53 PM
Hi Mike,
    Sorry I haven't responded in a while. We've had a ton of other projects going on. I'm back to working on this though and I have a short window to figure this out. I thought it was fixed, but it appears to be happening still. My original theory was this:
    I had originally installed the FBA user tool that was not part of CKS. Then I found the CKS on which was newer and better. So I attempted to remove the old FBA which got stuck in the process. Long story short, I was able to remove it. I honestly don't remember how. Then I installed the CKS FBA with pre-existing users in the database. We were having some trouble with that, so I came back here to see if I could find an answer and I noticed there was an update (this was back in October). So I updated it and now we are receiving this new error. I thought it was due to all of the users that were there in the database before, but now we are adding new users and receiving the same error. 
    Also, I should note that we were using roles before the final update, but that was one of the reasons I updated. We could not add roles from SharePoint. I had to do it within the database. So we've switched to using the groups instead of roles. Not sure if that makes a difference.
    I'm not a programmer, so I'm not really sure what to do with your message above. Sorry, but if there's any way for some help, it would be appreciated.
    Another quick question: Is it possible to have non site-colection admins able to add users? This is a huge problem with this current client I have this FBA tool configured on. They have 29 different people who need to be able to add/remove users.
Developer
Dec 5, 2008 at 3:25 PM
I won't have time to look at your main problem in any detail until next week, but to answer your last question, it might be possible to have non-site collection admins add users, but not without code changes.   There are some recent threads in this discussion forum about it, but it boils down to this:  You can modify the features and the code to remove the site collection admin requirement, but the User Information List, which is a built-in SharePoint list that stores profile information for WSS requires Site Collection Admin to add users.   It may be possible to modify the permissions of that list, but there could be unintended side effects (though I doubt it).

I recently started down this road, but we decided to get a 1.0 release out first, so I backed out my changes.  Hopefully we'll get this in a release in the near future, because it's a common requirement.  Check this discussion board for more info.

As for your main issue, I think you're going to have to attach a debugger to find out exactly where in the code the error is being thrown.  Hopefully you have someone in your organization who can do this, since you're not a programmer.  Otherwise you might have to retain a consultant for a few hours.  If there's a way to grant someone remote access, then you don't necessarily have find someone local (where are you located?).   I'll have a bit more time next week to look at the issue, to see if I can see something that might cause this. 

Regards,
Mike Sharp
Dec 5, 2008 at 7:00 PM
Thanks for the quick reply Mike,
    I have gone ahead and removed all traces of the FBA tool and FBA itself. Started over with a brand new database. Resetup my users and everything appears to be good so far. I'll let you know if I run into any other trouble.
    Let me know if you do get to change the security on the User Admins. I've looked all over the web for that and can't really find anything that fits what I'm looking for. This tool has been great for us and our client and honestly, that's the only thing missing. Thanks again!
Developer
Dec 5, 2008 at 7:20 PM
Ah, that sounds great!  My fingers are crossed.  ;^)

Yeah, changing the admin security is one of the main things I'd like to do.  Anthony Sumner has been working on extending the profile mechanism so you can add new fields to the member on an ad-hoc basis.  That will be huge, too, I think.  The third item I'd like to see is an auto-configuration tool for FBA, but that may have to be written from scratch.  I could use that right now, as a matter of fact.  Setting up FBA is the most time consuming part of setting up a WSS site for a new client.

Regards,
Mike Sharp
Dec 12, 2008 at 8:21 PM
Hi Mike,
    Hopefully you guys can figure out the admin security, you'll have to let me know if you ever do. Also adding new fields would be great. I'm trying to figure out how to add the ability to change the passwords in the useredit.aspx so my "admins" can change other users passwords to what they want. They didn't like the email a random password button. 
    Also, I had another problem. We went back to role based instead of group based users and now everytime they add a user the role doesn't stick the first time. It only sticks after they go back in and edit the user. We had this issue originally and that's why I switched to groups. Any ideas?
Jan 22, 2009 at 6:38 PM
I'm having a similar problem, but we have hundreds of FBA accounts, and I would rather not recreate them. Again, some accounts are fine, others throw the object reference error when I try to bring up the edit screen. All seem to work fine from a user standpoint though. We had a SharePoint environment set up with a previous version of the community kit. We moved to a new environment, bringing the aspnet membership database along, and I installed the newest version of the community kit. That's when the problem started. It also appears to have replaced all the 'full names' with the usernames.
Developer
Jan 22, 2009 at 6:57 PM

I've had problems migrating an AspNetMembership database as well, which I attributed to different machine keys at the time.  I had already re-created the new membership DB before I realized that might be the problem, so I can't say unequivocally that it was the cause.  In that case, my passwords were hashed, rather than encrypted, which meant I couldn't silently recover the membership database. 

When you say the Full Name is changed to the username, are you talking about within the database, or from the SharePoint UI? If you open the users table in Management Studio, and look at a suspect user, what do you see?  Compare that to the entry for that user in the User Information list.

I think in your case, while there may also be DB and membership provider problems, it seems like there's a synchronization problem related to the environment move between the DB and the User Information List, which is where WSS stores it's profile and membership information for each user.  You could write a small console app that would enumerate each FBA user directly from the membership provider, and call EnsureUser() against that user on the Site Collection.  This would write an entry into the User Information list if one of the users wasn't there already, and might fix the full name/ username issue.

Regards,
Mike Sharp

Jan 22, 2009 at 7:34 PM
I mean within the SharePoint UI. I don't remember seeing a field for name in the membership database. I'll see what I can do with a console app. I also renamed the membership provider, which forced SharePoint to repopulate its user list because it stores the provider as part of the username. I'm running MOSS 2007, for reference.
Jan 28, 2009 at 4:50 PM
We just implemented the FBA and for the most part - all is working well.  However, we cannot edit users in the FBA User Management (useredit.aspx).  We can open the page no problem, change the user information (like full name) no problem, save, no problem, go back in - the information is not changed.  Anyone else have this issue?
Feb 5, 2009 at 7:46 PM
Edited Feb 5, 2009 at 7:49 PM
I don't have a development box set up with Windows Server on it to start using the SharePoint SDK at the moment, so I'm looking for a non-code solution if one is available. I forgot to mention, I also changed the membership provider name, which I realize was a big mistake, as all the users were reimported as different users, and I had to reassign them all their permissions. Within SharePoint's UserInfo table, I set all the old users to inactive and deleted, so they don't show up in my lists anymore. I've compared records for working and non-working users, but found no discrepencies yet.

Edit:
Oh, and it looks like the 'Full Name' field is pulled from the 'tp_Title' field in the UserInfo table, and that has been reset to everyone's email, presumably because that value is not stored in the Membership database, so when I changed the provider name, it had no way to retaining them (as they were stored under a different provider name in the UserInfo table). I hope that made sense.
Feb 5, 2009 at 8:29 PM
New development. New users are not always accessible either. I just checked one that I created today, and I still cannot access the UserEdit screen for him without the error.
Feb 10, 2009 at 3:07 PM
Wait, but I have this problem and can't start over with a new database. I have 100's of users in production and can't edit their passwords or information. This seems to also cause issues with change password.

I hope there is a fix soon.
Developer
Feb 10, 2009 at 4:22 PM
Unfortunately, I'm not experiencing the issues...so a few questions:

1.  When you get the error, what does the URL querystring look like?

2.  Does it happen when the EditUser page loads, or when you try to make a change?


Mike
Feb 10, 2009 at 4:33 PM
Edited Feb 10, 2009 at 4:34 PM
http://www.mydomain.com/_layouts/FBA/Management/UserEdit.aspx?UserName=agood

Error: Object reference not set to an instance of an object.

I have no problem using Microsoft Shared View to allow you to see my config files... Let me know what you need.

Happends when you click on a name to edit. No all names cause an error some work just fine.

Seems random to me. I have users created years ago and users created last week, some work some don't but it's always the same ones that do or don't that I've seen.
Feb 13, 2009 at 3:25 PM
This is a critical issue, my change password and recover password don't work for most of the users that have this issue. The only solution is to delete their account and start over. This isn't good when we have so many users. We are getting more and more report of failed logins and I'm worried it's because of this.

Feb 13, 2009 at 3:42 PM
Edited Feb 13, 2009 at 3:55 PM
by the way I have roles off.

Is there a complete configuration file or report I can post to see if I'm outside standard or to help get this fixed?
http://www.thelazyninjas.com/work/fbadatabase.jpg

Here is a photo of my database user records, they look fine to me.

Developer
Feb 13, 2009 at 8:28 PM
Aha!  That's a clue.  Another fellow with what I think may be the same problem also has the role provider turned off.  And that may explain why I can't repro the issue, as I've got it on.

If you can post the relevant sections of your web.config, as well as a stack trace of the error (turn off custom errors temporarily, if you need to), then I'll have another look. 

Regards,
Mike Sharp
Developer
Feb 13, 2009 at 8:36 PM
Actually, I have an idea what is wrong.  When the original CKS:IEE FBA code was migrated to it's own project, Zac combined the horde of Features that had previously been used into a smaller set of Features, and set activation dependencies so that all the dependant features would be installed and activated.  This means that the Roles feature is probably activated, even if you're not using it.  In UserEdit.cs and UserNew.cs, there is a check for the feature, and it sets "_showRoles" (a boolean) if the feature is present.

You might try configuring/enabling roles (just don't set them for any of your users) in your FBA site, and see if the errors go away.

Regards,
Mike Sharp
Feb 16, 2009 at 2:25 PM
I have a pattern

User Name Email Full Name Active IsInSharePoint Modified Created
dummy
dummy@someonesemail.com Yes No

Any account that looks like this above works fine, however I am unable to lockout unlock out an account. Critical issue.

User Name Email Full Name Active IsInSharePoint Modified Created
dummy    
dummy@somonesemail.com dummy's name Yes Yes 7/24/2008 1:29:56 PM 7/24/2008 12:06:46 PM

Any account that looks like this above doesn't work and gives the error reported above.
Developer
Feb 16, 2009 at 4:57 PM

Ok, that's a pretty good clue.  I think what's happening is that when the user first browsed to the SharePoint site, some property in their entry in the user information list wasn't updated, or somewhere along the line the data was deleted.

Post an example of the failing user's entry in the User Information List.  You'll find it at your site's root:

/_catalogs/users/simple.aspx

Click on the failing user, and then look to see what's missing.  You should have entries for Name and Email.

If one is missing, try editing the user from the User Information List edit page, adding the missing data, and then go back to UserEdit.aspx and see if the user can now be opened.

Regards,
Mike Sharp

Developer
Feb 16, 2009 at 5:10 PM
Oh, wait a minute...what you posted above is from the User Information List, right? 

Mike
Developer
Feb 16, 2009 at 5:16 PM
Also, two other questions:

1.  Which version of FBA are you running?

2.  When you have a user who is working, and you go to the EditUser page, do you see the list of SP Groups?

Mike
Developer
Feb 16, 2009 at 5:18 PM
One last thing, the FBA writes exceptions (well, at least where they are handled) to the trace log.  Have you looked there to see if there are any interesting entries?

Mike
Feb 17, 2009 at 8:59 PM
<menu id="ctl00_PlaceHolderMain_UserMenu"><IE:MENUITEM id="ctl00_PlaceHolderMain_Edit" title="Edit" type="option" iconSrc="/_layouts/images/edititem.gif" onMenuClick="window.location = 'UserEdit.aspx?UserName=%USERNAME%';" text="Edit" menuGroupId="2147483647"></IE:MENUITEM><IE:MENUITEM id="ctl00_PlaceHolderMain_Delete" title="Delete" type="option" iconSrc="/_layouts/images/delete.gif" onMenuClick="window.location = 'UserDelete.aspx?UserName=%USERNAME%';" text="Delete" menuGroupId="2147483647"></IE:MENUITEM></menu>

A Membership Provider has not been configured correctly. Check the web.config setttings for this web application.

Just above error was the 1st one I've every found. When I try and go to http://intranet..../_layouts/FBA/Management/UsersDisp.aspx

web.config

<SafeControl Assembly="CKS.FormsBasedAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d0c9b215512a2c5d" Namespace="SPDevtools" TypeName="*" Safe="True" />

<

 

SafeControl Assembly="CKS.FormsBasedAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d0c9b215512a2c5d" Namespace="CKS.FormsBasedAuthentication" TypeName="*" Safe="True" />

 

<

 

SafeControl Assembly="CKS.FormsBasedAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d0c9b215512a2c5d" Namespace="CKS.FormsBasedAuthentication.HIP" TypeName="*" Safe="True" />

 

</

 

SafeControls>

 

<

 

PeoplePickerWildcards>

 

<

 

clear />

 

<

 

add key="AspNetSqlMembershipProvider" value="%" />

 

</

 

PeoplePickerWildcards>

 

</

 

SharePoint>

 

<

 

connectionStrings>

 

<

 

add name="AcSqlConnString" connectionString="server=****;database=ProjectSitesUsers;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />

 

</

 

connectionStrings>

 

<

 

system.web>

 

<!--

 

membership provider -->

 

<

 

membership defaultProvider="AcAspNetSqlMembershipProvider">

 

<

 

providers>

 

<

 

add name="AcAspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="AcSqlConnString" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Encrypted" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />

 

</

 

providers>

 

</

 

membership>

 

<!--

 

role provider -->

 

<

 

securityPolicy>

 

<

 

trustLevel name="WSS_Medium" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_mediumtrust.config" />

 

<

 

trustLevel name="WSS_Minimal" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_minimaltrust.config" />

 

<

 

trustLevel name="WSS_Custom" policyFile="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_custom_wss_minimaltrust_9adb0513-cb25-46ad-b2c1-55c8d45cda8f.config" />

 

</

 

securityPolicy>

 

<

 

httpHandlers>

 

<

 

remove verb="GET,HEAD,POST" path="*" />

 

<

 

add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

 

<

 

add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

 

</

 

httpHandlers>

 

<

 

customErrors mode="On" />

 

<

 

httpRuntime maxRequestLength="51200" />

 

<

 

authentication mode="Forms">

 

<

 

forms loginUrl="/aspx/login.aspx" />

 

</

 

authentication>

 

<

 

identity impersonate="true" />

 

<

 

authorization>

 

<

 

allow users="*" />

 

</

 

authorization>

 

<

 

httpModules>

 

<

 

clear />

 

<

 

add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

 

<

 

add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />

 

<

 

add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />

 

<

 

add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />

 

<

 

add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />

 

<

 

add name="RoleManager" type="System.Web.Security.RoleManagerModule" />

 

<!--

 

<add name="Session" type="System.Web.SessionState.SessionStateModule"/> -->

 

<

 

add name="CKS.FBAModule" type="CKS.FormsBasedAuthentication.BasicAuthenticationModule, CKS.FormsBasedAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d0c9b215512a2c5d" />

 


Developer
Feb 17, 2009 at 10:11 PM

Did you get this message in the trace log, or did it show up on the screen when you were trying to display your users?  I'm guessing it was on the screen.

This is kind of a weird error message.  AFAIK, it only happens in UsersDisp.aspx and RolesDisp.aspx.  Each of these pages "test" the membership provider in their OnInit event.  You get this if for any reason Membership.GetUser throws an exception.  The presumption is the membership provider is not configured correctly if it can't get the current user (you), but in order to see this error message in the first place, you have to be authenticated and in the SiteCollectionAdministrator role, or you can't get to this page.

What's even stranger to me is that it is also used in RolesDisp, which doesn't indicate anything about the role provider working.

Unfortunately, I don't think it has anything directly to do with your problem...but then it's hard for me to see how the error could happen in the first place, unless you have some intermittent problem with your database connectivity or locking.  The call updates the last-activity date/time stamp as well.  If this call fails, then that could account for problems with editing users.

I'm thinking that when you went to UsersDisp, some temporary glitch occurred, and you got this error.  If it happens a lot, I'd get worried.  But only once shouldn't be a problem.

Mike 

Developer
Feb 17, 2009 at 10:13 PM
Also, can you confirm:

This user works:

User Name Email Full Name Active IsInSharePoint Modified Created
dummy
dummy@someonesemail.com Yes No


This User does NOT work:

User Name Email Full Name Active IsInSharePoint Modified Created
dummy    
dummy@somonesemail.com dummy's name Yes Yes 7/24/2008 1:29:56 PM 7/24/2008 12:06:46 PM


Regards,
Mike Sharp
Developer
Feb 17, 2009 at 10:41 PM
Also, one more question.

Do you have more than one FBA-enabled (Forms Authentication of any kind) site in the WebApplication?

Regards,
Mike Sharp
Feb 25, 2009 at 2:32 PM
Edited Feb 25, 2009 at 8:20 PM
I can answer some of these questions.

First off, all my users look like this whether they work or not-
username
title Yes Yes 2/5/2009 4:18:38 PM 1/20/2009 8:43:14 AM

I have 2 FBA enabled sites. We have our main site configured with AD, but i've enabled FBA in it as well so I can manage those permissions. Then we have our FBA site which points to the same content.

I have roles enabled, but have not used them at all. I attempted to create a new role to test it, and I got a generic error. Here's what popped up in the MOSS logs, though I don't know for sure if it's all related to that action.

High        DelegateControl: Exception thrown in OnFormInit() method of child control for ControlId='ProfileRedirection'. Exception: System.Threading.ThreadAbortException: Thread was being aborted.     at Microsoft.SharePoint.Utilities.SPUtility.Redirect(String url, SPRedirectFlags flags, HttpContext context, String queryString)     at Microsoft.SharePoint.Utilities.SPUtility.Redirect(String url, SPRedirectFlags flags, HttpContext context)     at Microsoft.SharePoint.Portal.WebControls.MySiteRedirectionUserControl.RedirectIfNecessary(SPListItem user)     at Microsoft.SharePoint.Portal.WebControls.MySiteRedirectionUserControl.OnFormInit(Object objOfInterest)     at Microsoft.SharePoint.WebControls.DelegateControl.CallFormInitForChildren(Object objOfInterest)    
Medium      Unknown SPRequest error occurred. More information: 0x80070002    
Medium      Got List Item Version, but item was null.    
High        Exception Type: System.NullReferenceException  Exception Message: Object reference not set to an instance of an object.

Edit
I forgot, I'm also unable to make any edits from the User Info page you suggested (/_catalogs/users/simple.aspx). While the users do have both a name and email, when I click 'Edit Item', I'm only given the Account line with the full FBA username, and no way to make any changes.
Mar 6, 2009 at 6:10 PM
Are you guys still working on this? I still haven't found a solution.
Mar 6, 2009 at 7:28 PM
No, I've not fixed mine but I'm thinking it's related to the fact I don't have roles on so the role provider check fails, my problem is I've never used roles, I started with the alpha build of the non-CKS kit, during the release of WSS3.

Therefor I don't have anything created in my database and don't know how to add it. I have 100's of in production users so messing with database causes me concern.
Developer
Mar 6, 2009 at 8:12 PM
Hmmm...I'm starting to get an idea of what's going wrong...

Are you using automatic approval of membership requests, or do you approve members via the Site Membership Review List?

Regards,
Mike Sharp
Mar 6, 2009 at 9:46 PM
site membership review list

From: rdcpro [notifications@codeplex.com]
Sent: Friday, March 06, 2009 2:12 PM
To: Jeremy Benisek
Subject: Re: Error message - Object reference not set to an instance of an object [CKS:39621]

From: rdcpro

Hmmm...I'm starting to get an idea of what's going wrong...

Are you using automatic approval of membership requests, or do you approve members via the Site Membership Review List?

Regards,
Mike Sharp
Mar 9, 2009 at 12:22 PM
I'm not using membership requests at all. I create all accounts manually.
Mar 16, 2009 at 1:30 PM
Mike, you said you have an idea of what's going on?
Mar 16, 2009 at 3:21 PM
I'm not sure if it's related, but I'm also getting this error when I try to create a new FBA role -

Object reference not set to an instance of an object.   at CKS.FormsBasedAuthentication.RoleNew.OnSubmit(Object sender, EventArgs e)
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Mar 24, 2009 at 7:16 PM
Mike, did you get anywhere on this?
Apr 1, 2009 at 5:27 AM

Hi All,

    I also have this problem described in the first post above.  I can now reproduce the problem at will, and I think I have found a solution/workaround without deleting users by trying different senarios.
    Our organisation installed sharepoint about a month ago, it was set up by a consultant to use FBA. At first everthing was working ok, recently the error started occuring.  

    Here's what I found:
    
    If I create a new FBA user, I can edit the user ok.

    I have multiple sharepoint sites set up. One is called "testing"
    I have set up groups on the site called "testing - owners", "testing - members", etc with correspondng permissions.
    
    Now I want to give my user permission to the "testing" web site, so I click on the group "testing - members" and click "Add user" from the drop down.
    Under "Give permission", I select the default -  "Add users to a SharePoint group" - and select ""testing - members"
    Now - I go back to Site Settings - FBA User Management and try and edit the user, and I get the ERROR.

    If I now remove the user from the group, the error goes away and I can edit the user.

    Now, if I add the user to the site using the option "Give users permission directly" instead of "Add users to a SharePoint group", all works well.

    So in summary, my guess is that FBA user permissions don't work with groups.   You need to apply the permissions directly.
    Strangely enough though it did seem to work for a while (until the consultant left the building)

    Hope this helps 

    
   
Apr 27, 2009 at 4:38 PM
Mike, I'm still waiting on an update... if you guys have given up, I'll need to find another way around
Developer
Apr 27, 2009 at 5:17 PM
Sorry, I haven't given up, just been buried up to my eyeballs in deadlines.  The last pressing deadline of this batch of projects is Wednesday, and once I get a good nights sleep... :) 

I'm curious, though, if you've noted the same results as webfabrik?

Mike
Apr 28, 2009 at 12:04 PM
It doesn't seem like it. I just created a user and added him to a menagerie of different groups for testing, but I was still able to edit him regardless of what group he was in.
May 11, 2009 at 8:22 PM

Mike, I hate to be a pain, but I'm still waiting on you for a resolution here if there is one.

May 11, 2009 at 8:27 PM
Me too

Sent from my Windows Mobile® phone.


From: orthod0ks <notifications@codeplex.com>
Sent: Monday, May 11, 2009 2:23 PM
To: Jeremy Benisek <jb@dontpanic.biz>
Subject: Re: Error message - Object reference not set to an instance of an object [CKS:39621]

From: orthod0ks

Mike, I hate to be a pain, but I'm still waiting on you for a resolution here if there is one.

Jun 1, 2009 at 2:24 PM

Mike? I feel like I'm becoming quite the annoyance...

Jun 3, 2009 at 6:14 AM
Edited Jun 3, 2009 at 6:17 AM

had the same error. Fixed by changing the following code in RoleNew.cs

from
private InputFormTextBox txtRole;
private Label lblMessage;

to
protected InputFormTextBox txtRole;
protected Label lblMessage;

after that you need to recompile and deploy the solution again. Hope it helps.

Jun 17, 2009 at 3:25 PM

I'm not using FBA Roles for anything, so I'm not hitting that page at all.

Jun 18, 2009 at 2:31 PM

I do not use roles and never created a role database. Can I disable the role check and solve this problem?

From: orthod0ks [mailto:notifications@codeplex.com]
Sent: Wednesday, June 17, 2009 9:28 AM
To: Jeremy Benisek
Subject: Re: Error message - Object reference not set to an instance of an object [CKS:39621]

From: orthod0ks

I'm not using FBA Roles for anything, so I'm not hitting that page at all.

Read the full discussion online.

To add a post to this discussion, reply to this email (CKS@discussions.codeplex.com)

To start a new discussion for this project, email CKS@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2009 at 3:37 PM
Edited Jun 19, 2009 at 1:21 PM

I've noticed that if you remove users from SharePoint groups using the SharePoint User management (/_layouts/people.aspx?<foobar>), you can't edit the user anymore and the Group Membership don't display for that user with the FBA User Management. Adding the user back to a group using the SharePoint interface will make them editable again!

Jun 19, 2009 at 1:13 PM

I've also noted that if you activate the FBAMAnagementSelf with the stsadm using a local Windows admin account it activates fine. But if you activate the feature from the Site using "Site Collection Feature" and your AppPool does not have SQL sysadmin (or is not a local Windows admins, whitch are granted sysadmin by default) you get an error is the logs about insufficient SharePoint_Config database access. More precisly, it looks like you need to activate the feature with more SQL elevated rights then the default AppPool account or you get a SharePoint_Config database error.

That leads me to the question that could this problem be related to the way the feature accesses the databases?

Jun 28, 2009 at 10:27 PM

I'm also getting the error "A Membership Provider has not been configured correctly. Check the web.config setttings for this web application" on three brand new farms.

The solution worked prior to the SharePoint SP2, so I'm wondering if there is something that has affected this.  Unfortunately, the inability to work with the FBA users in SharePoint directly, has caused me to createa small web app to manage FBA Users, which also creates teh confusion and aggravation of visiting a separate site just to create, update, and delete users in the FBA database.

As it's been more than two months since the developer's last post (stating that he does not have time), in response to a request for a fix, leads me to believe that this project has been abandoned.  It would probably be in the user's best interest in finding an alternate solution, such as the original FBA solution posted on codeplex:  http://www.codeplex.com/fba

 

 

Developer
Jun 30, 2009 at 8:19 AM

Hi We have had this when extending and making changes something removes the config data in the different zones, go see if its there.


Anthony Sumner
Director

black



Phone:
Fax:

0845 122 7181
0870 1673883

Email:
Website:

asumner@planetweb.co.uk
www.planetweb.co.uk


From: NHSPGURU [mailto:notifications@codeplex.com]
Sent: 28 June 2009 23:27
To: Anthony Sumner
Subject: Re: Error message - Object reference not set to an instance of an object [CKS:39621]

From: NHSPGURU

I'm also getting the error "A Membership Provider has not been configured correctly. Check the web.config setttings for this web application" on three brand new farms.

The solution worked prior to the SharePoint SP2, so I'm wondering if there is something that has affected this. Unfortunately, the inability to work with the FBA users in SharePoint directly, has caused me to createa small web app to manage FBA Users, which also creates teh confusion and aggravation of visiting a separate site just to create, update, and delete users in the FBA database.

As it's been more than two months since the developer's last post (stating that he does not have time), in response to a request for a fix, leads me to believe that this project has been abandoned. It would probably be in the user's best interest in finding an alternate solution, such as the original FBA solution posted on codeplex: http://www.codeplex.com/fba

Read the full discussion online.

To add a post to this discussion, reply to this email (CKS@discussions.codeplex.com)

To start a new discussion for this project, email CKS@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Aug 12, 2009 at 9:08 AM

I have a client who is using CKS 24196 with this issue.   As it turns out, the "group issue" noted by webfabrik was the root cause for this particular client.

I noticed that the groups listed in the FBA UserEdit page for a user that does work, is not the complete list of groups in the SharePoint site.  On further investigation, all the groups that were mising, had no permission to access the site, this can be seen using the following steps;  click the group in People and Groups, then from Settings, choose Group Settings, scroll to the bottom and you will see "Give Group Permission to this Site".  You will notice that the "problem" groups will not have any check boxes selected.

The problem relates to the code below from OnLoad( ) in UserEdit.cs (line 113):

// load groups
groupList.DataSource = this.Web.Groups;
groupList.DataBind();

// select groups associated with the user
foreach (SPGroup group in spuser.Groups)
{
           groupList.Items.FindByText(group.Name).Selected = true;
}

 

this.Web.Groups will not return any groups that do not have permission to View the site (there may be other conditions affecting which groups are returned).  So, when it tries to find the group in the checkbox list, it won't find it, giving the null reference exception.

So potential work arounds until this is verified, and a better solution implemented:

1 )   Give the group view or restricted read - this is NOT a recommendation. Consider your security requirements, do your own due diligence and testing.

2 )   Update the code similar to the following (above disclaimer applies here too):

// select groups associated with the user
foreach (SPGroup group in spuser.Groups)
{

           ListItem i = groupList.Items.FindByText(group.Name);

           if(i != null) i.Selected = true;
}

This will ignore groups it doesn't know about and should be safe regarding the "submit" code, as only the groups in the CheckBoxList are changed.

Aug 18, 2009 at 5:58 PM

I don't have a SharePoint development environment set up (haven't needed it enough to set up a new server box to run the sdk). Would someone that's fixed the UserEdit file mind posting a corrected version somewhere?

Oct 12, 2010 at 7:19 PM

orthod0ks

 

I can't recomple the code for roles check removed could you do this for me? I must fix this problem, the roles check is the problem I think for me.

 

Jeremy

 

I can enable remote access and we could pay for a few hours if need be. But I must get access to my user accounts.