Showing posts with label SSP url. Show all posts
Showing posts with label SSP url. Show all posts

Monday, June 28, 2010

Programmatically get SSP URL of Farm

Programmatically get SSP URL of Farm

If you are playing with farm than easily get Farm's SSP URL as per below code lines or Use below function.

public static string GetFarmSSPURL()
{
string url = string.Empty;
ServerContext sc = ServerContext.Default;
object ssp = sc.GetType().GetProperty("SharedResourceProvider",
BindingFlags.Instance | BindingFlags.NonPublic).GetValue(sc, null);
Guid sspGuid = (Guid)ssp.GetType().GetProperty("AdministrationSiteId").GetValue(ssp, null);
using (SPSite sspSite = new SPSite(sspGuid))
{
url = sspSite.WebApplication.GetResponseUri(SPUrlZone.Default).AbsoluteUri + "ssp/admin";
}
return url;
}