Hi,
I'm building a module that can create a new portal (like the admin/portal module). So I checked how the portals module does that and used the same function: PortalController.CreatePortal(...).
But when I run this function I keep getting a security error, which I don't understand. Does anyone know what I'm doing wrong?
Error:
Error parsing Portal TemplateViolation of UNIQUE KEY constraint 'IX_FolderPermission'. Cannot insert duplicate key in object 'dbo.FolderPermission'.
The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
Code:
blnChild;string strPortalAlias;int intPortalId;string strServerPath;string strChildPath = "";PortalController objPortalController = new PortalController();//Portal Name
blnChild =
strPortalAlias =
strServerPath = DotNetNuke.Common.
false;"test213321414324";Globals.GetAbsoluteServerPath(Request);//Get Home Directory
string HomeDir = "";//Template
{
{
Templates.Add(
}
}
List<string> Templates = new List<string>();string[] fileEntries = System.IO.Directory.GetFiles(DotNetNuke.Common.Globals.HostMapPath, "*.template");foreach (string strFileName in fileEntries)if (Path.GetFileNameWithoutExtension(strFileName) != "admin")Path.GetFileNameWithoutExtension(strFileName));string strTemplateFile = Templates[0].ToString();//Create a user
objAdminUser.FirstName =
objAdminUser.LastName =
objAdminUser.Username =
objAdminUser.DisplayName =
objAdminUser.Email =
objAdminUser.IsSuperUser =
objAdminUser.Membership.Approved =
objAdminUser.Membership.Password =
objAdminUser.Membership.PasswordQuestion =
objAdminUser.Membership.PasswordAnswer =
objAdminUser.Profile.FirstName =
objAdminUser.Profile.LastName =
UserInfo objAdminUser = new UserInfo();"wimpie";"none";"wimpie2348798432";"wimpie2348798432";"willem@spam.la";false;true;"password1234";"question";"answer";"Wimpie";"None";//Create portal
intPortalId = objPortalController.CreatePortal(
"titlem321321", objAdminUser, "dsad", "adasd", DotNetNuke.Common.Globals.HostMapPath, strTemplateFile, HomeDir, strPortalAlias, strServerPath, strChildPath, blnChild);
bool