Note: This is related to build 5.3.1, not sure about this in other builds
I have been building a site that is to have multiple parent and multiple child portals under each parent that have the following schema:
Parent Portal of:
portal1.dummyportal.com
With child portals like:
portal1.dummyportal.com/spa
portal1.dummyportal.com/golf
When I went to create Portal 2 with a url like portal2.dummyportal.com the Parent created fine but when I went to create the first child portal of: portal2.dummyportal.com/spa I received an error that the child portal already existed (no it didn't) and the portal creation stopped before anything was created.
On examination, of my folders, I found that when the first child portal (portal1.dummyportal.com/spa) was created it created a folder called "spa" in the root of the web. I tried renaming the folder and then tried to create the new child and it worked, so obviously this was the "duplicate" portal.
In looking at this folder, there is only one file, default.aspx and when I tried to access either child portal, they worked fine, so this one file in the one folder was driving both portals. On examining the code, this file reads the url that comes in and redirects to the correct portal. So why is there a check for this folder it exists and if so throw an error if it does when it will work with the existing file.
So digging further, I looked at the code that creates portals and in file "/DesktopModules/Admin/Portals/Signup.ascx.vb" at around line 243 is a check to see if the folder exists and throw an error if it does. But if you look at the PortalController.vb at around line1266 it does a check to see if the folder exists and creates if it doesn't and then checks for default.aspx existance in the folder and creates if it doesn't and then goes on and creates the portal.
So in conclusion, if you comment out the check for the existance of the Child Portal in SignUp.ascx.vb to make it read like the following, your code will reuse the child folders created.
'Set Portal Alias for Child Portals
If strMessage = "" Then
If blnChild Then
strChildPath = strServerPath & strPortalAlias
' Removed because this is handled in the PortalController in that it
'If System.IO.Directory.Exists(strChildPath) Then --- COMMENTED OUT
'strMessage = Localization.GetString("ChildExists", Me.LocalResourceFile) --- COMMENTED OUT
'Else --- COMMENTED OUT
If PortalSettings.ActiveTab.ParentId <> PortalSettings.SuperTabId Then
strPortalAlias = GetDomainName(Request) & "/" & strPortalAlias
Else
strPortalAlias = txtPortalName.Text
End If
'End If --- COMMENTED OUT
End If
End If
Is it a bug or not, I don't know, but I have seen lots of problems on the net describing this error message and none that get to the root of the problem, throwing an error on the existence of a folder that doesn't matter if it exists or not.