/// <summary> /// returns the portalId or -1 if something goes wrong /// </summary> /// <param name="context"></param> /// <returns></returns> public static int getPortalId(HttpContext context) { var retVal = -1; var url = getUriWithoutProtocol(context.Request.Url); var controller = new PortalAliasController(); var aliasCollection = controller.GetPortalAliases(); foreach (string key in aliasCollection.Keys) { var info = aliasCollection[key]; if (url.StartsWith(info.HTTPAlias)) { retVal = info.PortalID; } } return(retVal); }
/// <summary> /// returns the portalId or -1 if something goes wrong /// </summary> /// <param name="context"></param> /// <returns></returns> public void setPortalIdAndPageName(HttpContext context) { portalId = -1; asmxName = null; var url = getUriWithoutProtocol(context.Request.Url); var controller = new PortalAliasController(); var aliasCollection = controller.GetPortalAliases(); foreach (string key in aliasCollection.Keys) { var info = aliasCollection[key]; if (url.StartsWith(info.HTTPAlias)) { portalId = info.PortalID; asmxName = url.Substring(info.HTTPAlias.Length + 1); } } }