public HttpResponseMessage SwitchSite(SwitchSiteDTO dto) { if (UserController.GetCurrentUserInfo().IsSuperUser) { try { if ((!string.IsNullOrEmpty(dto.Site))) { int selectedPortalID = int.Parse(dto.Site); var portalAliases = TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(selectedPortalID).ToList(); if ((portalAliases.Count > 0 && (portalAliases[0] != null))) { return(Request.CreateResponse(HttpStatusCode.OK, new { RedirectURL = Globals.AddHTTP(((PortalAliasInfo)portalAliases[0]).HTTPAlias) })); } } } catch (System.Threading.ThreadAbortException) { //Do nothing we are not logging ThreadAbortxceptions caused by redirects } catch (Exception ex) { Exceptions.LogException(ex); } } return(Request.CreateResponse(HttpStatusCode.InternalServerError)); }
public HttpResponseMessage SwitchSite(SwitchSiteDTO dto) { if (UserController.GetCurrentUserInfo().IsSuperUser) { try { if ((!string.IsNullOrEmpty(dto.Site))) { int selectedPortalID = int.Parse(dto.Site); var portalAliases = TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(selectedPortalID).ToList(); if ((portalAliases.Count > 0 && (portalAliases[0] != null))) { return Request.CreateResponse(HttpStatusCode.OK, new { RedirectURL = Globals.AddHTTP(((PortalAliasInfo)portalAliases[0]).HTTPAlias) }); } } } catch (System.Threading.ThreadAbortException) { //Do nothing we are not logging ThreadAbortxceptions caused by redirects } catch (Exception ex) { Exceptions.LogException(ex); } } return Request.CreateResponse(HttpStatusCode.InternalServerError); }