示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            string      userContextId           = Plt1WebHandler.GetUserContextId(context);
            bool        isMowa                  = OfflineClientRequestUtilities.IsRequestFromMOWAClient(context.Request, context.Request.UserAgent);
            HttpRequest request                 = context.Request;
            string      clientAddressWithoutPII = this.GetClientAddressWithoutPII(request);
            UserAgent   userAgent               = OwaUserAgentUtilities.CreateUserAgentWithLayoutOverride(context);
            string      userName                = string.Empty;
            string      cookieValueAndSetIfNull = ClientIdCookie.GetCookieValueAndSetIfNull(context);
            UserContext userContext             = UserContextManager.GetUserContext(context, false);

            if (userContext != null && userContext.LogonIdentity != null)
            {
                SmtpAddress primarySmtpAddress = userContext.LogonIdentity.PrimarySmtpAddress;
                userName = userContext.LogonIdentity.PrimarySmtpAddress.ToString();
            }
            if (Plt1WebHandler.IsPlt1PerformanceRequest(request))
            {
                string text = "";
                if (context.Request.HttpMethod == "POST")
                {
                    using (StreamReader streamReader = new StreamReader(context.Request.InputStream))
                    {
                        text = streamReader.ReadToEnd();
                        context.Response.AppendToLog(text);
                    }
                }
                string clientVersion = context.Request.QueryString.Get("cver") ?? string.Empty;
                Uri    uri;
                string refererQueryString = request.TryParseUrlReferrer(out uri) ? uri.Query : "noRefUrl";
                Dictionary <string, string> dictionary  = new Dictionary <string, string>();
                Dictionary <string, string> dictionary2 = new Dictionary <string, string>();
                Plt1WebHandler.GetPlt1PerformanceEventData(userAgent, refererQueryString, request.QueryString, text, dictionary, dictionary2);
                Plt1WebHandler.AddClientLoadTimeDataPoint(dictionary, dictionary2, userContextId, clientAddressWithoutPII, clientVersion, isMowa, userName, userContext, cookieValueAndSetIfNull);
                if (dictionary2.Count > 0 && dictionary.ContainsKey("msg") && dictionary["msg"].Contains("success"))
                {
                    Plt1WebHandler.AddCalculatedClientLoadTimeDataPoint(dictionary, dictionary2, userContextId, clientAddressWithoutPII, clientVersion, isMowa, userName, cookieValueAndSetIfNull);
                }
                if (userContext != null && userContext.FeaturesManager != null && userContext.FeaturesManager.ServerSettings.OwaServerLogonActivityLogging.Enabled)
                {
                    this.AddtoActivityLog(userContext, dictionary, userName, clientAddressWithoutPII, userAgent.RawString);
                }
            }
            else
            {
                string         clientVersion2  = context.Request.QueryString.Get("v") ?? string.Empty;
                ClientLogEvent plt1AccessEvent = Plt1WebHandler.GetPlt1AccessEvent(userContextId, request.UserAgent, clientAddressWithoutPII, clientVersion2, isMowa, cookieValueAndSetIfNull);
                OwaClientLogger.AppendToLog(plt1AccessEvent);
            }
            Plt1WebHandler.SetResponseHeaders(context.Response);
            Plt1WebHandler.WriteImage(context.Response);
        }
示例#2
0
 protected override void OnPreInit(EventArgs e)
 {
     this.UserAgent = OwaUserAgentUtilities.CreateUserAgentWithLayoutOverride(this.Context);
     this.IsAppCacheEnabledClient        = this.GetIsClientAppCacheEnabled(this.Context);
     this.IsOfflineAppCacheEnabledClient = (this.IsAppCacheEnabledClient && this.IsClientInOfflineMode);
     this.CompositeSessionData           = this.CalculateCompositeSessionDataEnabled();
     base.Response.AddHeader("pragma", "no-cache");
     base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
     base.Response.Cache.SetExpires(DateTime.UtcNow.AddYears(-1));
     if (UrlUtilities.IsAuthRedirectRequest(this.Context.Request) || AppCacheManifestHandlerBase.DoesBrowserSupportAppCache(this.UserAgent))
     {
         string url = null;
         if (this.ShouldRedirectWithoutUnnecessaryParams(out url))
         {
             base.Response.Redirect(url);
         }
     }
 }