I had come across a situation where i had to get the sharepoint central admin's url.. You can follow the following snippet of the code. At the begining add the namespace
using Microsoft.SharePoint.Administration;
SPAdministrationWebApplication centralAdminFarmUrl = Microsoft.SharePoint.Administration.SPAdministrationWebApplication.Local;
String centralAdminUrl = centralAdminFarmUrl.Sites[0].Url;
This may help someone
-Cheers
Pradeepa Achar
Comments