Example #1
0
        private void SetResetPinUrl()
        {
            Section       section       = base.Sections["UMMailboxConfigurationSection"];
            PopupLauncher popupLauncher = (PopupLauncher)section.FindControl("popupLauncherDataCenter");

            popupLauncher.NavigationUrl = EcpUrl.AppendQueryParameter(popupLauncher.NavigationUrl, "id", base.ObjectIdentity.RawIdentity);
        }
Example #2
0
        private void SetAddExtensionUrl(PowerShellResults <SetUMMailboxConfiguration> result)
        {
            Section             section             = base.Sections["UMMailboxExtensionSection"];
            EcpCollectionEditor ecpCollectionEditor = (EcpCollectionEditor)section.FindControl("ceExtensions");

            ecpCollectionEditor.PickerFormUrl = EcpUrl.AppendQueryParameter(ecpCollectionEditor.PickerFormUrl, "dialPlanId", result.Value.DialPlanId);
        }
Example #3
0
 private static bool GetRelativePathToAppRootRange(string url, out int start, out int end)
 {
     start = -1;
     end   = -1;
     if (EcpUrl.HasScheme(url))
     {
         return(false);
     }
     if (EcpUrl.IsAppRelativePath(url))
     {
         start = 2;
     }
     else if (EcpUrl.IsRelativeUrl(url))
     {
         start = 0;
     }
     else if (EcpUrl.IsRooted(url) && url.StartsWith(EcpUrl.EcpVDirForStaticResource))
     {
         start = EcpUrl.EcpVDirForStaticResource.Length;
     }
     if (start == -1)
     {
         return(false);
     }
     end = url.IndexOf('?');
     if (end == -1)
     {
         end = url.Length;
     }
     return(start < end);
 }
Example #4
0
        private void BuildScriptDescriptor(ScriptComponentDescriptor descriptor)
        {
            descriptor.AddElementProperty("SearchButton", this.searchButton.ClientID, true);
            descriptor.AddElementProperty("ClearButton", this.clearButton.ClientID, true);
            descriptor.AddComponentProperty("FromEditor", this.senderMatches.ClientID, true);
            descriptor.AddComponentProperty("ToEditor", this.recipientMatches.ClientID, true);
            descriptor.AddElementProperty("MessageIDTextBox", this.messageIDTextBox.ClientID, true);
            descriptor.AddElementProperty("ClientIPTextBox", this.originalClientIPTextbox.ClientID, true);
            descriptor.AddElementProperty("ReportTitleTextBox", this.reportTitleTextbox.ClientID, true);
            descriptor.AddElementProperty("NotifyAddressTextBox", this.emailTextbox.ClientID, true);
            descriptor.AddElementProperty("DdMessageTimeFrame", this.ddMessageTimeframe.ClientID, true);
            descriptor.AddElementProperty("DdDeliveryStatus", this.ddDeliveryStatus.ClientID, true);
            descriptor.AddElementProperty("DdDeliveryStatusEx", this.ddDeliveryStatusEx.ClientID, true);
            descriptor.AddElementProperty("DirectionDropdown", this.ddDirection.ClientID, true);
            descriptor.AddElementProperty("TimeZoneDropdown", this.ddTimeZone.ClientID, true);
            descriptor.AddElementProperty("ReportOptionsPanel", "panelOnDemandOptions", true);
            descriptor.AddElementProperty("DateRangePanel", "dateRangePanel", true);
            descriptor.AddElementProperty("IncludeReportDetails", this.chkReportDetails.ClientID, true);
            descriptor.AddComponentProperty("StartDate", this.startDate.ClientID, true);
            descriptor.AddComponentProperty("EndDate", this.endDate.ClientID, true);
            descriptor.AddComponentProperty("DockPanel", this.dockpanel.ClientID, true);
            WebServiceReference webServiceReference = new WebServiceReference(EcpUrl.EcpVDirForStaticResource + "DDI/DDIService.svc?schema=MessageTraceEx");

            descriptor.AddProperty("ServiceUrl", EcpUrl.ProcessUrl(webServiceReference.ServiceUrl));
        }
 public static void SendCanary(this HttpContext context, ref CanaryStatus canaryStatus, ref bool shouldAddLog)
 {
     if (context.Request.IsAuthenticated && !context.IsLogoffRequest())
     {
         bool       flag = false;
         string     cachedUserUniqueKey = context.GetCachedUserUniqueKey();
         string     canaryName          = context.GetCanaryName();
         HttpCookie httpCookie          = context.Request.Cookies[canaryName];
         if (httpCookie != null && Canary.RestoreCanary(httpCookie.Value, cachedUserUniqueKey) != null)
         {
             flag = true;
         }
         if (!flag)
         {
             if (httpCookie != null)
             {
                 EcpEventLogConstants.Tuple_ResetCanaryInCookie.LogEvent(new object[]
                 {
                     EcpEventLogExtensions.GetUserNameToLog(),
                     cachedUserUniqueKey,
                     canaryName,
                     context.GetRequestUrlForLog(),
                     (httpCookie != null) ? httpCookie.Value : string.Empty
                 });
             }
             Canary     canary      = new Canary(Guid.NewGuid(), cachedUserUniqueKey);
             HttpCookie httpCookie2 = new HttpCookie(canaryName, canary.ToString());
             httpCookie2.HttpOnly = false;
             httpCookie2.Path     = EcpUrl.GetEcpVDirForCanary();
             context.Response.Cookies.Add(httpCookie2);
             canaryStatus |= CanaryStatus.IsCanaryRenewed;
         }
     }
     shouldAddLog = true;
 }
        internal static void TransferToErrorPage(string cause, bool showCallStack)
        {
            HttpContext httpContext = HttpContext.Current;

            if (httpContext.IsWebServiceRequest())
            {
                ErrorHandlingModule.SendJsonError(httpContext, httpContext.GetError(), cause);
                return;
            }
            if (httpContext.IsUploadRequest())
            {
                ErrorHandlingModule.SendJsonErrorForUpload(httpContext, httpContext.GetError());
                return;
            }
            EcpPerfCounters.RedirectToError.Increment();
            if (!showCallStack)
            {
                httpContext.ClearError();
            }
            httpContext.Response.Clear();
            string text  = string.Format("~/error.aspx?cause={0}", cause);
            string text2 = httpContext.Request.QueryString["isNarrow"];

            if (text2 != null)
            {
                text = EcpUrl.AppendQueryParameter(text, "isNarrow", text2);
            }
            httpContext.Server.Transfer(text);
        }
Example #7
0
        protected void RenderMiddleNav()
        {
            switch (this.topNavType)
            {
            case _Default.TopNav.NoTopNav:
                return;

            case _Default.TopNav.O365GNav:
            case _Default.TopNav.O365GNavFallback:
                if (NavigationUtil.ShouldRenderOwaLink(RbacPrincipal.Current, this.showAdminFeatures.Value) && !string.IsNullOrWhiteSpace(HttpContext.Current.GetOwaNavigationParameter()))
                {
                    base.Response.Output.Write("<div id=\"middleNavZone\" class=\"{3}\" ><div class=\"middleLeftNav\"><a id=\"returnToOWA\" onclick=\"return JumpTo('{2}', true);\" title=\"{0}\" href=\"#\"><img id=\"imgRetrunToOWA\" class=\"NavigationSprite ReturnToOWA\" src='{1}' alt=\"{0}\" title=\"{0}\"/></a></div></div>", new object[]
                    {
                        OwaOptionStrings.ReturnToOWA,
                        Util.GetSpriteImageSrc(this),
                        HttpUtility.HtmlEncode(HttpUtility.JavaScriptStringEncode(EcpUrl.GetOwaNavigateBackUrl())),
                        "o365MiddleNav"
                    });
                    return;
                }
                return;
            }
            if ((!this.showAdminFeatures.Value || !RbacPrincipal.Current.IsInRole("ControlPanelAdmin")) && !string.IsNullOrWhiteSpace(HttpContext.Current.GetOwaNavigationParameter()))
            {
                base.Response.Output.Write("<div id=\"middleNavZone\" class=\"{3}\" ><div class=\"middleLeftNav\"><a id=\"returnToOWA\" onclick=\"return JumpTo('{2}', true);\" title=\"{0}\" href=\"#\"><img id=\"imgRetrunToOWA\" class=\"NavigationSprite ReturnToOWA\" src='{1}' alt=\"{0}\" title=\"{0}\"/></a></div></div>", new object[]
                {
                    OwaOptionStrings.ReturnToOWA,
                    Util.GetSpriteImageSrc(this),
                    HttpUtility.HtmlEncode(HttpUtility.JavaScriptStringEncode(EcpUrl.GetOwaNavigateBackUrl())),
                    "defaultMiddleNav"
                });
            }
        }
Example #8
0
        private string GetDeliveryReportUrl()
        {
            string text = (string)base.Cache["DeliveryReportUrl"];

            if (text != null)
            {
                return(text);
            }
            lock (this.cacheLock)
            {
                text = (string)base.Cache["DeliveryReportUrl"];
                if (text == null)
                {
                    Uri ecpexternalUrl = this.GetECPExternalUrl();
                    if (ecpexternalUrl != null)
                    {
                        text = new Uri(ecpexternalUrl, this.Context.GetRequestUrlAbsolutePath()).ToString();
                    }
                    else
                    {
                        text = EcpUrl.ResolveClientUrl(this.Context.GetRequestUrl().GetLeftPart(UriPartial.Path));
                    }
                    if (text != null)
                    {
                        base.Cache["DeliveryReportUrl"] = text;
                    }
                }
            }
            return(text);
        }
Example #9
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ViewDetailsCommand viewDetailsCommand = (ViewDetailsCommand)this.listViewSearchResults.Commands.FindCommandByName("viewdetails");

            if (viewDetailsCommand != null)
            {
                viewDetailsCommand.NavigateUrl = EcpUrl.ProcessUrl(EcpUrl.EcpVDirForStaticResource + "MessageTrace/MessageTraceDetails.aspx");
            }
        }
Example #10
0
        private static string InternalOnPremiseLinkToOffice365(string serviceInstance)
        {
            if (EacEnvironment.Instance.IsDataCenter)
            {
                return(string.Empty);
            }
            string url = CrossPremiseUtil.InternalGetLinkToCrossPremise(HttpContext.Current, HttpContext.Current.Request, serviceInstance);

            return(EcpUrl.AppendQueryParameter(url, "ov", "1"));
        }
Example #11
0
        public static string GetEcpVDirForCanary()
        {
            string text = EcpUrl.ProcessUrl(EcpUrl.EcpVDirForStaticResource, true, EcpUrl.EcpVDirForStaticResource, false, true);

            if (text.EndsWith("/"))
            {
                text = text.Substring(0, text.Length - 1);
            }
            return(text);
        }
Example #12
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (string.IsNullOrEmpty(this.Page.Request["dialPlanId"]))
            {
                throw new BadQueryParameterException("dialPlanId");
            }
            EcpSingleSelect ecpSingleSelect = (EcpSingleSelect)base.ContentContainer.FindControl("pickerUMDialPlan");

            ecpSingleSelect.PickerFormUrl = EcpUrl.AppendQueryParameter(ecpSingleSelect.PickerFormUrl, "dialPlanId", this.Page.Request["dialPlanId"]);
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            this.image = this.FindImage(this, "imgUserPhoto");
            Identity identity = Identity.FromExecutingUserId();

            foreach (PopupLauncher popupLauncher in this.GetVisibleControls <PopupLauncher>(this))
            {
                popupLauncher.NavigationUrl = EcpUrl.AppendQueryParameter(popupLauncher.NavigationUrl, "id", identity.RawIdentity);
            }
        }
Example #14
0
        private void RedirectIfTargetTenantSpecifiedForRegularAdmin()
        {
            HttpContext httpContext = HttpContext.Current;

            if (httpContext.HasTargetTenant() && (base.IsInRole("LogonUserMailbox") || base.IsInRole("LogonMailUser")))
            {
                string url = EcpUrl.ProcessUrl(httpContext.GetRequestUrlPathAndQuery(), true, EcpUrl.EcpVDirForStaticResource, true, false);
                httpContext.Response.Redirect(url, true);
                throw new InvalidOperationException();
            }
        }
Example #15
0
        public static string GetRelativePathToAppRoot(string url)
        {
            int num;
            int num2;

            if (!EcpUrl.GetRelativePathToAppRootRange(url, out num, out num2))
            {
                return(null);
            }
            return(url.Substring(num, num2 - num));
        }
Example #16
0
        protected void BuildScriptDescriptor(ScriptComponentDescriptor descriptor)
        {
            descriptor.AddElementProperty("SenderDomainTextArea", this.txtSenderDomainList.ClientID, true);
            descriptor.AddElementProperty("SearchButton", this.searchButton.ClientID, true);
            descriptor.AddElementProperty("ClearButton", this.clearButton.ClientID, true);
            descriptor.AddComponentProperty("BannedSenderCollectionEditor", this.bannedSenderCollectionEditor.ClientID, true);
            descriptor.AddComponentProperty("CollectionEditorRefreshMethod", this.bannedSenderDataSource.RefreshWebServiceMethod.ClientID, true);
            WebServiceReference webServiceReference = new WebServiceReference(EcpUrl.EcpVDirForStaticResource + "DDI/DDIService.svc?schema=BannedSender");

            descriptor.AddProperty("ServiceUrl", EcpUrl.ProcessUrl(webServiceReference.ServiceUrl));
        }
 protected override void OnPreRender(EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.ViewModel))
     {
         if (this.ServiceUrl != null)
         {
             this["ServiceUrl"] = EcpUrl.ProcessUrl(this.ServiceUrl.ServiceUrl);
         }
         AttributeCollection bindingContextAttributes = this.GetBindingContextAttributes();
         bindingContextAttributes.Add("data-type", this.ViewModel);
         foreach (KeyValuePair <string, object> keyValuePair in this.dataContextProperties)
         {
             object value = keyValuePair.Value;
             string value2;
             if (value is string)
             {
                 value2 = (string)value;
             }
             else if (value is bool)
             {
                 value2 = value.ToString().ToLower();
             }
             else if (value is int || value is uint || value is long || value is ulong || value is float || value is double)
             {
                 value2 = value.ToString();
             }
             else
             {
                 value2 = "json:" + keyValuePair.Value.ToJsonString(DDIService.KnownTypes.Value);
             }
             bindingContextAttributes.Add("vm-" + keyValuePair.Key, value2);
         }
         if (bindingContextAttributes != base.Attributes)
         {
             List <string> list = new List <string>(base.Attributes.Count);
             foreach (object obj in base.Attributes.Keys)
             {
                 string text = obj as string;
                 if (text != null && text.StartsWith("vm-"))
                 {
                     bindingContextAttributes.Add(text, base.Attributes[text]);
                     list.Add(text);
                 }
             }
             foreach (string key in list)
             {
                 base.Attributes.Remove(key);
             }
         }
     }
     base.OnPreRender(e);
 }
 protected override void BuildScriptDescriptor(ScriptComponentDescriptor descriptor)
 {
     base.BuildScriptDescriptor(descriptor);
     descriptor.AddEvent("Invoking", this.OnClientInvoking, true);
     descriptor.AddEvent("Completed", this.OnClientCompleted, true);
     descriptor.AddEvent("Succeeded", this.OnClientSucceeded, true);
     descriptor.AddEvent("Failed", this.OnClientFailed, true);
     descriptor.AddProperty("ParameterNames", this.ParameterNames);
     descriptor.AddProperty("ServiceUrl", EcpUrl.ProcessUrl(this.ServiceUrl.ServiceUrl));
     descriptor.AddProperty("MethodName", this.Method);
     descriptor.AddProperty("ExceptionHandlerIDs", this.ExceptionHandlersIDs);
     descriptor.AddScriptProperty("Parameters", this.Parameters.ToJavaScript(this));
     descriptor.AddProperty("AlwaysInvokeSave", this.AlwaysInvokeSave);
 }
Example #19
0
        private void FlightRewrite(HttpContext context)
        {
            string relativePathToAppRoot = EcpUrl.GetRelativePathToAppRoot(context.Request.FilePath);

            if (relativePathToAppRoot != null)
            {
                string rewriteUrl = EacFlightProvider.Instance.GetRewriteUrl(relativePathToAppRoot);
                if (rewriteUrl != null)
                {
                    string str = EcpUrl.ReplaceRelativePath(context.Request.FilePath, rewriteUrl, true);
                    context.RewritePath(str + context.Request.PathInfo);
                }
            }
        }
Example #20
0
        private static bool AppendEsoUserIfAny(HttpContext context, string url, ref StringBuilder sb, bool isFullPath, string vdir)
        {
            bool   result       = false;
            string explicitUser = context.GetExplicitUser();

            if (!string.IsNullOrEmpty(explicitUser))
            {
                EcpUrl.EnsureStringBuilderInitialized(ref sb, isFullPath, vdir);
                sb.Append(explicitUser);
                sb.Append('/');
                result = true;
            }
            return(result);
        }
Example #21
0
        public static string GetOwaNavigateBackUrl()
        {
            string text = EcpUrl.OwaVDir;
            string owaNavigationParameter = HttpContext.Current.GetOwaNavigationParameter();

            if (!string.IsNullOrWhiteSpace(owaNavigationParameter))
            {
                NameValueCollection nameValueCollection = HttpUtility.ParseQueryString(owaNavigationParameter);
                for (int i = 0; i < nameValueCollection.Count; i++)
                {
                    text = EcpUrl.AppendFragmentParameter(text, nameValueCollection.Keys[i] ?? string.Empty, nameValueCollection[i]);
                }
            }
            return(text);
        }
Example #22
0
        public static string ReplaceRelativePath(string url, string newRelativePath, bool throwIfFail)
        {
            int length;
            int num;

            if (EcpUrl.GetRelativePathToAppRootRange(url, out length, out num))
            {
                return(url.Substring(0, length) + newRelativePath + url.Substring(num, url.Length - num));
            }
            if (throwIfFail)
            {
                throw new ArgumentException("Can not determine relative path", "url");
            }
            return(null);
        }
Example #23
0
        private static bool AppendDelegatedTenantIfAny(HttpContext context, string url, ref StringBuilder sb, bool isFullPath, string vdir)
        {
            bool   result       = false;
            string targetTenant = context.GetTargetTenant();

            if (!string.IsNullOrEmpty(targetTenant) && !context.HasOrganizationContext())
            {
                EcpUrl.EnsureStringBuilderInitialized(ref sb, isFullPath, vdir);
                sb.Append('@');
                sb.Append(targetTenant);
                sb.Append('/');
                result = true;
            }
            return(result);
        }
        public static void LogEvent(HttpContext context, string canaryVersion, CanaryStatus canaryStatus)
        {
            string canaryName       = context.GetCanaryName();
            string ecpVDirForCanary = EcpUrl.GetEcpVDirForCanary();
            string logonUniqueKey;

            if (context.User is RbacSession)
            {
                logonUniqueKey = context.GetCachedUserUniqueKey();
            }
            else
            {
                logonUniqueKey = string.Empty;
            }
            ActivityContextLogger.Instance.LogEvent(new CanaryLogEvent(canaryVersion, ActivityContext.ActivityId.FormatForLog(), canaryName, ecpVDirForCanary, logonUniqueKey, canaryStatus, DateTime.MinValue, null));
        }
        public NavigationTreeNode(SiteMapNode siteMapNode)
        {
            this.ID         = siteMapNode["id"];
            this.Title      = siteMapNode.Title;
            this.Format     = Util.GetPageTitleFormat(siteMapNode);
            this.Url        = EcpUrl.ProcessUrl(siteMapNode.Url);
            this.HybridRole = siteMapNode["hybridRole"];
            bool noCache;

            bool.TryParse(siteMapNode["noCache"], out noCache);
            this.NoCache = noCache;
            bool flag;

            bool.TryParse(siteMapNode["contentPage"], out flag);
            this.hasContentPage = flag;
            this.isContentPage  = flag;
        }
Example #26
0
        private void CalculateUrl()
        {
            Uri uri = new Uri(this.url, UriKind.RelativeOrAbsolute);

            if (!uri.IsAbsoluteUri)
            {
                string text  = EcpUrl.GetLeftPart(this.url, UriPartial.Path);
                string text2 = this.url.Substring(text.Length);
                text = VirtualPathUtility.ToAbsolute(text);
                if (!string.IsNullOrEmpty(text2))
                {
                    text += text2;
                }
                text = EcpUrl.AppendQueryParameter(text, "exsvurl", "1");
                uri  = new Uri(text, UriKind.Relative);
            }
            this.calculatedUrl = uri;
        }
Example #27
0
        protected override void BeginGetNavBarPack(ShellServiceClient client, NavBarInfoRequest request)
        {
            string value = HttpContext.Current.Request.QueryString["flight"];

            if (!string.IsNullOrEmpty(value))
            {
                EndpointAddress address = client.Endpoint.Address;
                Uri             uri     = new Uri(EcpUrl.AppendQueryParameter(address.Uri.AbsoluteUri, "flight", value));
                client.Endpoint.Address = new EndpointAddress(uri, address.Identity, new AddressHeader[0]);
            }
            this.stopwatch = new Stopwatch();
            this.stopwatch.Start();
            this.shellServiceTask = new Task(delegate()
            {
                this.GetNavBarInfoAndHandleException(client, request);
            });
            this.shellServiceTask.Start();
        }
        protected override void BuildScriptDescriptor(ScriptComponentDescriptor descriptor)
        {
            base.BuildScriptDescriptor(descriptor);
            BaseForm baseForm = this.Page as BaseForm;

            if (baseForm != null)
            {
                descriptor.AddComponentProperty("Form", "aspnetForm");
            }
            descriptor.AddElementProperty("PickerTextBox", this.pickerTextBox.ClientID, this);
            descriptor.AddElementProperty("AddButton", this.btnAddItem.ClientID, this);
            descriptor.AddElementProperty("BottomPanel", this.bottomPanel.ClientID, this);
            descriptor.AddComponentProperty("WellControl", this.wellControl.ClientID, this);
            descriptor.AddProperty("ServiceUrl", EcpUrl.ProcessUrl(this.ServiceUrl.ServiceUrl), true);
            descriptor.AddProperty("ErrorProperty", this.ErrorProperty, true);
            descriptor.AddProperty("CanRetryProperty", this.CanRetryProperty, true);
            descriptor.AddProperty("WarningProperty", this.WarningProperty, true);
            descriptor.AddProperty("SpriteSrc", Util.GetSpriteImageSrc(this));
        }
Example #29
0
        public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
        {
            string relativePathToAppRoot = EcpUrl.GetRelativePathToAppRoot(node.Url);

            if (relativePathToAppRoot != null)
            {
                string rewriteUrl = EacFlightProvider.Instance.GetRewriteUrl(relativePathToAppRoot);
                if (!EacFlightProvider.Instance.IsUrlEnabled(rewriteUrl ?? relativePathToAppRoot))
                {
                    return(false);
                }
                if (rewriteUrl != null)
                {
                    node     = node.Clone();
                    node.Url = EcpUrl.ReplaceRelativePath(node.Url, rewriteUrl, true);
                }
            }
            return(base.IsAccessibleToUser(context, node));
        }
        private static void HandleDelegatedSecurityTokenExpire(HttpContext context)
        {
            context.ClearError();
            HttpResponse response = context.Response;

            response.Clear();
            if (context.IsWebServiceRequest())
            {
                response.ContentType = "text/html";
                response.StatusCode  = 443;
                string s = "<HTML><BODY>443 Delegated Security Token Expired.</BODY></HTML>";
                response.Write(s);
                response.End();
                return;
            }
            string url = EcpUrl.ProcessUrl("/ecp/error.aspx?cause=tokenrenewed&exsvurl=1", true);

            EcpPerfCounters.RedirectToError.Increment();
            response.Redirect(url, true);
        }