Dropthings and Active Directory

Sep 29, 2008 at 9:58 PM

I'm attempting to setup Dropthings to use in conjunction with Active Directory to build a corporate intranet, but I'm having some trouble.

When I try to hit the site from a browser session from outside the domain, I get prompted for login credentials, and then I'm allowed into the dropthings site w/o incident.

However, when I loginto a PC inside the domain using the credentials as before, and open a browser session to the Dropthings site, I don't get prompted for login credentials (expected), but I get the following error message in the browser.

It appears to be dieing inside this bit of code in the GetUserSettingActivity.cs program:

 

 

    UserSetting newSetting = new UserSetting();

    newSetting.UserId = UserGuid;
    newSetting.CurrentPageId = (
from page in db.Pages
        where page.UserId == UserGuid
        select page.ID).SingleOrDefault();   
    db.UserSettings.InsertOnSubmit(newSetting);
    db.SubmitChanges();  // <--  program is dieing here!

 

 

Anybody else experience this error?

I would appreciate any help.


Error Message:

--------------------------------------------------------------------------------
Server Error in '/Dropthings' Application.
--------------------------------------------------------------------------------

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UserSetting_aspnet_Users". The conflict occurred in database "Dashboard", table "dbo.aspnet_Users", column 'UserId'.
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: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UserSetting_aspnet_Users". The conflict occurred in database "Dashboard", table "dbo.aspnet_Users", column 'UserId'.
The statement has been terminated.

Source Error:

Line 198:            //_Setup = Cache[Profile.UserName] as UserPageSetup;
Line 199:            //if( noCache || null == _Setup )
Line 200:                _Setup = new DashboardFacade(Profile.UserName).LoadUserSetup(pageTitle);
Line 201:        }
Line 202:
 

Source File: c:\Inetpub\wwwroot\Dropthings\Default.aspx.cs    Line: 200

Stack Trace:

[SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UserSetting_aspnet_Users". The conflict occurred in database "Dashboard", table "dbo.aspnet_Users", column 'UserId'.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
   System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +219
   System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +113
   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +344
   System.Data.Linq.StandardChangeDirector.DynamicInsert(TrackedObject item) +67
   System.Data.Linq.StandardChangeDirector.Insert(TrackedObject item) +202
   System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) +236
   System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) +331
   System.Data.Linq.DataContext.SubmitChanges() +19
   DashboardBusiness.Activities.GetUserSettingActivity.Execute(ActivityExecutionContext executionContext) in F:\downloads\dropthings\Dropthings-Src\DashboardBusiness\Activities\UserActivities\GetUserSettingActivity.cs:80
   System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) +42
   System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) +49
   System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) +475
   System.Workflow.Runtime.Scheduler.Run() +373

[WorkflowException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UserSetting_aspnet_Users". The conflict occurred in database "Dashboard", table "dbo.aspnet_Users", column 'UserId'.
The statement has been terminated.]
   DashboardBusiness.WorkflowHelper.ExecuteWorkflow(Type workflowType, Dictionary`2 properties) in F:\downloads\dropthings\Dropthings-Src\DashboardBusiness\Workflows\WorkflowHelper.cs:71
   DashboardBusiness.DashboardFacade.LoadUserSetup(String pageTitle) in F:\downloads\dropthings\Dropthings-Src\DashboardBusiness\DashboardFacade.cs:50
   _Default.LoadUserPageSetup(Boolean noCache) in c:\Inetpub\wwwroot\Dropthings\Default.aspx.cs:200
   _Default.CreateChildControls() in c:\Inetpub\wwwroot\Dropthings\Default.aspx.cs:160
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

 

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

Sep 30, 2008 at 8:49 PM
Ok, I have the AD functionality working.  It helps to turn on "Integrated Windows Authentication" on the app's virtual directory.  I had re-installed the app a few days earlier while working on another issue, and forgot to make this change.