I have setup DNN with auto auth for our domain and found that the auto authentication sometime does not collect the correct details and in somecases if the domain user account does not have firstname or lastname set, this causes the "User Accounts" (under Admin) to fail to load with the following error:
(I have tested this in DNN3 and DNN4, and believe that it's the datagrid/or other control that displays the users in the Users.ascx)
ModuleId: 357
ModuleDefId: 15
FriendlyName: User Accounts
ModuleControlSource: Admin/Users/Users.ascx
AssemblyVersion: 04.03.02
Method: DotNetNuke.UI.WebControls.TextColumnTemplate.GetValue
FileName:
FileLineNumber: 0
FileColumnNumber: 0
PortalID: 0
PortalName: Portal Name
UserID: 251
UserName: domain\useraccount
ActiveTabID: 42
ActiveTabName: User Accounts
AbsoluteURL: /Default.aspx
AbsoluteURLReferrer: http://sitename/Admin/UserAccounts/tabid/42/Default.aspx
ExceptionGUID: 7e36f539-da34-4e0d-aed4-496aae1cf83f
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
InnerException: Object reference not set to an instance of an object.
Message: DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.UI.WebControls.TextColumnTemplate.GetValue(DataGridItem container) at DotNetNuke.UI.WebControls.TextColumnTemplate.Item_DataBinding(Object sender, EventArgs e) at System.Web.UI.Control.OnDataBinding(EventArgs e) at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBind() at System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) at System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) at System.Web.UI.WebControls.BaseDataList.DataBind() at DotNetNuke.Modules.Admin.Users.UserAccounts.BindData(String SearchText, String SearchField) in D:\webroots\sitename\Admin\Users\Users.ascx.vb:line 211 at DotNetNuke.Modules.Admin.Users.UserAccounts.Page_Load(Object sender, EventArgs e) in D:\webroots\sitename\Admin\Users\Users.ascx.vb:line 495 --- End of inner exception stack trace ---
StackTrace:
Source:
Server Name: SERVERNAME
My initial fix for this was to manually edit the dbo.Users table, and add in the fields required, since then I have updated the dbo.AddUsers to the following:
set
ANSI_NULLS ON
set
QUOTED_IDENTIFIER ON
GO
ALTER
PROCEDURE [dbo].[AddUser]
@PortalID
int,
@Username
nvarchar(100),
@FirstName
nvarchar(50),
@LastName
nvarchar(50),
@AffiliateId
int,
@IsSuperUser
bit,
@Email
nvarchar(256),
@DisplayName
nvarchar(100),
@UpdatePassword
bit,
@Authorised
bit
AS
DECLARE
@UserID int
SELECT
@UserID = UserID
FROM Users
WHERE Username = @Username
-- BEGIN -- Added by Popcorn69
-- This modification stops the Userlist failing when loading DNN
If
@FirstName = ''
BEGIN
SELECT @FirstName = @Username
END
If
@LastName = ''
BEGIN
SELECT @LastName = '-'
END
IF
@DisplayName = ''
BEGIN
SELECT @DisplayName = @Username
END
-- END -- Added by Popcorn69
IF
@UserID is null
BEGIN
INSERT INTO Users (
Username
,
FirstName
,
LastName
,
AffiliateId
,
IsSuperUser
,
Email
,
DisplayName
,
UpdatePassword
)
VALUES (
@Username
,
@FirstName
,
@LastName
,
@AffiliateId
,
@IsSuperUser
,
@Email
,
@DisplayName
,
@UpdatePassword
)
SELECT @UserID = SCOPE_IDENTITY()
END
IF
@IsSuperUser = 0
BEGIN
IF not exists ( SELECT 1 FROM UserPortals WHERE UserID = @UserID AND PortalID = @PortalID )
BEGIN
INSERT INTO UserPortals (
UserID
,
PortalID
,
Authorised
)
VALUES (
@UserID
,
@PortalID
,
@Authorised
)
END
END
SELECT
@UserID
I hope someone finds this usefull.