Custom asp.net web admin database

I'm stuck in a problem and I need a hint. I am using my own SQL Server database to manage users and roles (as opposed to aspnet DB). It worked fine until I added some custom fields to the aspnet_membership table. After that, I am unable to create a new user through the asp.net web administration tool. The following exception is thrown:

An error has occurred. Go back to the previous page and try again.

The following message can help diagnose the problem: The exception was caused by the target of the call. at System.RuntimeMethodHandle._InvokeMethodFast (Object target, Object [] arguments, SignatureStruct & sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodributesFast (Object target, Object [] arguments, Signature methodAttributes) System.Reflection.RuntimeMethodInfo.Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture, Boolean skipVisibilityChecks) to System.Reflection.RuntimeMethodInfo.Invoke (Object obinderj, BindingFlags invoke binder, Object , Culture CultureInfo) at System.Web.Administration.WebAdminMembershipProvider.CallWebAdminMembershipProviderHelperMethodOutParams (String methodName, Object [], Type [] paramTypes parameters) in System.Web.Administration.WebAdminMembershipProvider.CreateUser (String username, String password, string email address, string passwordQuroestion, StringAppolens MembershipCreateStatus & Status) at System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser () at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick (WizardNavigationEventArgs e) at System.Webrol.UII.E. EventArgs e) at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent (source object, EventArgs e) at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent (source object, EventArgs arguments) at System.Web.UI. Control.RaiseBubbleEvent (Source Object, EventArgs) at System.Web.UI.WebControls.Button.OnCommand (CommandEventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent (String eventArgument) at System.Web.UI.ButtonControls .System.Web.UI.IPostBackEventHandler.RaisePostBackEvent (String eventArgument) at System.Web.UI.Page.RaisePostBackEvent (IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.Raise SystemPostBackEvent UI.Page.ProcessRequestMain (Boolean includeStagesBeforeA syncPoint, Boolean includeStagesAfterAsyncPoint)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 includeStagesBeforeA syncPoint, Boolean includeStagesAfterAsyncPoint)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 includeStagesBeforeA syncPoint, Boolean includeStagesAfterAsyncPoint)

This only happens during user creation. Everything else works fine. I have already tried running the aspnet_regsql utility again. Any other suggestions? Any help would be greatly appreciated.

- Ali

+2


source to share


3 answers


Assuming, have you added any of the fields you specified as Not NULL and have no default values?



If so, make sure you fill them in in the code that adds the user.

+1


source


Are additional columns valid for null values? Have you identified suitable defaults if they are not?

Have you updated the stored procedures that write to the membership tables? If so, you will need to write a custom membership role provider to fill them in - what are the details?

It would probably be better to store these values โ€‹โ€‹against the Profile for the user - unless they are explicitly related to their membership, which the custom provider is the way to go.




Edit response to Ali's comments

In this case (marking the account as deleted / inactive), then yes it probably makes sense to store this in relation to the membership table - they are related to the users' site membership.

However - the main problem I see with your approach is that if you are using the default controls, the user can still log in initially, and then you will need to check the value of the "Deleted" field in either handlers LoggingIn (before authentication) or LoggedIn (after) events - you can get away with changing the built-in IsApproved

to handle this from the default.

+1


source


Thank you, Zhaf and Oded. NULL values โ€‹โ€‹were a problem. But Zhaf pointed out another problem that I would like to know more about. Additional data is similar to isDeleted, where I just mark isDeleted as true without having to delete the user, and then some relevant auditing data like deletedByUser, dateDeleted, etc. (And some applications). I have not updated the stored procedures that write to the membership tables. Instead, I have a few extra SPs that populate additional data as soon as the user is created. Is this (storing the field in the membership table and creating new procedures) the correct approach?

0


source







All Articles