Hello Roger - great interface!
I'm installing into an existing c# ASP.NET (4.0) project with pre-established ASP.NET Membership Provider. I thought I had manually configured the references to the current / separate membership database correctly, but am receiving the following error - I'm guessing when it is attempting to sync roles. The only problem is - it seems to be trying to push role data to our membership db - versus pull into the project db.
Here are the details:
Cannot insert the value NULL into column 'RoleId', table 'ASPNET_ASONS.dbo.aspnet_Roles'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'RoleId', table 'ASPNET_ASONS.dbo.aspnet_Roles'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Source Error:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\sos_online\39883719\832ed445\App_Web_w312piaa.9.cs Line: 0
Stack Trace:
[SqlException (0x80131904): Cannot insert the value NULL into column 'RoleId', table 'ASPNET_ASONS.dbo.aspnet_Roles'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +404
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1363
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +6368941
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +6370642
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +538
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +689
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +327
System.Web.Security.SqlRoleProvider.CreateRole(String roleName) +1074
GalleryServerPro.Web.Controller.RoleController.CreateRole(String roleName) +194
GalleryServerPro.Web.Controller.UserController.ProcessInstallerFile() +408
GalleryServerPro.Web.Controller.GalleryController.InitializeApplication() +345
GalleryServerPro.Web.Controller.GalleryController.InitializeGspApplication() +437
[TypeInitializationException: The type initializer for 'GalleryServerPro.Web.Pages.GalleryPage' threw an exception.]
GalleryServerPro.Web.Pages.GalleryPage..ctor() +0
GalleryServerPro.Web.Pages.album..ctor() +17
ASP.gsp_pages_album_ascx..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\sos_online\39883719\832ed445\App_Web_w312piaa.9.cs:0
__ASP.FastObjectFactory_app_web_w312piaa.Create_ASP_gsp_pages_album_ascx() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\sos_online\39883719\832ed445\App_Web_w312piaa.11.cs:0
System.Web.UI.TemplateControl.LoadControl(IWebObjectFactory objectFactory, VirtualPath virtualPath, Type t, Object[] parameters) +235
System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) +205
GalleryServerPro.Web.Gallery.LoadRequestedPage() +203
System.Web.UI.Control.InitRecursive(Control namingContainer) +133
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Control.InitRecursive(Control namingContainer) +421
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1970
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225
Here are the pertinent portions of the web.config as well:
<sectionGroup name="system.web">
<section name="galleryServerPro" type="GalleryServerPro.Configuration.GalleryServerProConfigSettings, GalleryServerPro.Configuration" allowDefinition="MachineToApplication" requirePermission="false" />
</sectionGroup>
...
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="ASPNetConnectionString" connectionString="Data Source=WRSGDEV***;Initial Catalog=ASPNET_ASONS;Persist Security Info=True;User ID=SOS_AspNet*****;Password=*****" providerName="System.Data.SqlClient" />
<!-- BEGIN: GSP - Addition -->
<!-- <add name="SqlServerCeGalleryDb" providerName="System.Data.SqlServerCe.4.0" connectionString="data source=|DataDirectory|\GalleryServerPro_Data.sdf" /> -->
<add name="SqlServerDbConnection" connectionString="server=WRSGDev**** uid=ASONS_*** pwd=*****;Trusted_Connection=no;database=Asons_SOS20;Application Name=ASONS20" />
<!-- <add name="SqlServerDbConnection" connectionString="Data Source=WRSGDEVS01;Initial Catalog=ASONS_SOS20;Persist Security Info=True;User ID=ASONS_***;Password=*****;Application Name=ASONS20" providerName="System.Data.SqlClient" /> -->
<!-- END: GSP - Addition -->
</connectionStrings>
...
<galleryServerPro>
<core galleryResourcesPath="gsp" />
<dataProvider defaultProvider="SqlServerGalleryServerProProvider">
<providers>
<clear />
<add applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection" name="SqlServerGalleryServerProProvider" type="GalleryServerPro.Data.SqlServer.SqlDataProvider" />
</providers>
</dataProvider>
</galleryServerPro>
...
<membership defaultProvider="ASPNetSqlMembershipProvider" userIsOnlineTimeWindow="20">
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ASPNetConnectionString" applicationName="ASONS20" enablePasswordRetrieval="false" enablePasswordReset="true" passwordFormat="Hashed" requiresUniqueEmail="false" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" />
<!-- <add applicationName="Gallery Server Pro" name="SqlCeMembershipProvider" connectionStringName="SqlServerCeGalleryDb" passwordFormat="Clear" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="2" maxInvalidPasswordAttempts="50" enablePasswordReset="true" enablePasswordRetrieval="true" passwordAttemptWindow="10" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" type="GalleryServerPro.Data.SqlCe.SqlCeMembershipProvider" />
<add applicationName="Gallery Server Pro" name="SqlMembershipProvider" connectionStringName="SqlServerDbConnection" passwordFormat="Clear" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="2" maxInvalidPasswordAttempts="50" enablePasswordReset="true" enablePasswordRetrieval="true" passwordAttemptWindow="10" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" type="System.Web.Security.SqlMembershipProvider" />
-->
</providers>
</membership>
<!--<roleManager enabled="true" />-->
<roleManager enabled="true" cacheRolesInCookie="false" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" defaultProvider="AspNetSqlRoleProvider" createPersistentCookie="false">
<providers>
<remove name="AspNetSqlRoleProvider" />
<add name="AspNetSqlRoleProvider" connectionStringName="ASPNetConnectionString" applicationName="ASONS20" type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>
Again, with the config settings above, our core application interface works fine, but we receive the error message listed above.
Any guidance is appreciated as I'd like to stage for demo to a client this afternoon.
Thanks!
-Keith