Applications that insist their administrative stuff runs in a folder called /admin do not play well with Interland.  Community Server is one of these applications.

My friend and coworker Jason was updating the website of his band, TheBitters.  Prior to now they had a site with a good design (Jason’s pretty solid with the graphical stuff) but poor updateability.  The image gallery was outdated, the news and show schedule as well.  We just put in a Community Server installation at the office for IT communications and an internal blog, and he thought that would be the perfect framework for the band site so that he can keep it updated and functional like he wants with limited hassle.  Good idea…

…Until the Interland monster reared its head.  Jason had been having some problems getting into and managing his CS install.  He could log in, but trying to get to the admin stuff would put up a pop-up login box and not let him in.  We went last night and he played a show while I got drunk, and at some point during the show the band blamed him for the website being broken, and he committed me to fixing it right there on the microphone, which I later used to my advantage, demanding they play an encore at the end of the night and holding the site hostage.

But that’s beside the point.  In our hung over states, we both seemingly simultaneously figured out the CS problem on Interland – the admin folder.  He popped his head in my office to tell me about it at the exact time I was looking at his Interland admin panel trying to figure out the structure thereof.  Basically, the deal is that as an Interland customer, you have a web control panel for your account at http://yoursite/admin.  The problem is that it’s an IIS virtual folder which points to some central spot that everyone shares.  If you create an /admin folder on your site, it will go there, and your files will be there, but you will not be able to access them in the browser because the virtual directory takes the requests and acts as if the hard directory doesn’t exist.  So a login box comes up, which is your interland login, and you can’t load the CS admin stuff.

So, the solution:  Change the admin folder of CS.  Easier said than done.  I started searching, and found this on the CS forums.  It got me about 5% of the way there.  Step one is to open the siteurls.config folder in the root and change

<location name=”admin” path=”/admin/” />

to

<location name=”admin” path=”/yournewfolder/” />

That’s not the whole story though, as ScottW would have you believe.  That does change the link on the tab, but there’s a lot more to do.  First, when you try to access it, you will end up with one of these: 

System.IO.FileNotFoundException: Could not find file "c:\adminpage\comadmin\tab.config".
File name: "c:\adminpage\comadmin\tab.config"
   at System.IO.__Error.WinIOError(Int32 errorCode, String str)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at CommunityServer.Components.Serializer.ConvertFileToObject(String path, Type objectType)
   at CommunityServer.Controls.TabControl.GetTabs()
   at CommunityServer.Controls.TabControl.CreateTabMarkUp()
   at CommunityServer.Controls.TabControl.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
   at System.Web.UI.Control.Render(HtmlTextWriter writer)
   at CommunityServer.Components.CSPage.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
   at System.Web.UI.Page.ProcessRequestMain()

ExceptionMessage: Exception of type System.Web.HttpUnhandledException was thrown.

PathAndQuery: /comadmin/default.aspx

In this case, the c:\adminpage\comadmin\ is the path on the server that does the admin share.  What does this mean?  Somewhere in our code we are doing a Server.MapPath(“/admin”) even though we changed the config.  Reflector to the rescue (since you have to register to get the source, Reflector is faster.  Plus community server won’t mail to me and I have to use my work email on their site).

Point Reflector at CommunityServer.Controls and look into the TabControl class.  The offender is actually the FileLocation property, which has the getter doing a hard look at “/admin/tab.config”.

public string FileLocation
{
    get
    {
        if (this._fileLocation == null)
        {
            this._fileLocation = "~/admin/tab.config";
        } return this._fileLocation
    }
    set
    { this._fileLocation = value; }
}

There’s probably a fairly simple way to get it to read what we put in the siteurls.config, but seriously, I drank a lot Thursday night and just wanted to get this up and running.  So I just hard coded my new folder location, built the CommunityServer.Controls assembly, deployed it to the web server, and Bob’s your uncle we have a working admin path.  Kinda.

The next step is to go to the /newadminfolder/tab.config file and replace all instances of /admin with /newadminfolder.  With that done, the bitch work starts.  Because all those freakin aspx pages in all the folders and subfolders of /newadminfolder have a hard link to a stylesheet in /admin/whatever.css.  So you gotta open them and change them all.  It isn’t every file, but it’s enough to be annoying.  And that’s when I really took my first issue with Community Server design.  As impressive as an application it is, why can’t all the pages be themed to a central location?  Why put the CSS files in different places?  Why hardcode a folder path like that?  It’s a great piece of software, believe me, I just was annoyed that I had to open 50 friggin files to get the look right. 

Also, in the gallery admin pages, there’s a reference to a .js file.  For some reason it’s hardcoded to /admin/whatever but it’s in the same folder as the files that reference it.  Whatever.  Just make sure you catch it.

Once you’ve done all that, your folder is moved and you have a fully functional CS admin site on Interland (or any host that does similar).  Hope I helped the next hung over guy that just wants to move a damn folder.