public void GetDocument() { bool flag = false; ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentEventHandler.GetDocument"); base.ShowErrorInPage = true; base.DontWriteHeaders = true; HttpContext httpContext = base.OwaContext.HttpContext; if (!DocumentLibraryUtilities.IsDocumentsAccessEnabled(base.UserContext)) { throw new OwaSegmentationException("Access to this document library is disabled"); } string text = (string)base.GetParameter("id"); string s = (string)base.GetParameter("URL"); DocumentLibraryObjectId documentLibraryObjectId = DocumentLibraryUtilities.CreateDocumentLibraryObjectId(base.OwaContext); if (documentLibraryObjectId == null) { return; } try { this.DataBind(documentLibraryObjectId); } finally { if (this.stream == null) { this.Dispose(); } } if (this.stream == null) { return; } UserContext userContext = base.OwaContext.UserContext; AttachmentPolicy.Level levelForAttachment = AttachmentLevelLookup.GetLevelForAttachment(Path.GetExtension(this.fileName), this.contentType, userContext); if (base.IsParameterSet("allowLevel2")) { flag = true; } if (levelForAttachment == AttachmentPolicy.Level.Block) { string errorDescription = string.Format(CultureInfo.InvariantCulture, LocalizedStrings.GetNonEncoded(1280363351), new object[] { this.fileName }); Utilities.TransferToErrorPage(base.OwaContext, errorDescription, null, ThemeFileId.ButtonDialogInfo, true); return; } if (levelForAttachment == AttachmentPolicy.Level.ForceSave && !flag) { string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "ns"); string text2 = string.Concat(new string[] { "<br> <a onclick=\"return false;\" href=\"ev.owa?ns=", queryStringParameter, "&ev=GetDoc&allowLevel2=1&URL=", Utilities.UrlEncode(s), "&id=", Utilities.UrlEncode(documentLibraryObjectId.ToBase64String()), Utilities.GetCanaryRequestParameter(), "\">", Utilities.HtmlEncode(this.fileName), "</a>" }); string errorDetailedDescription = string.Format(CultureInfo.InvariantCulture, LocalizedStrings.GetHtmlEncoded(-625229753), new object[] { text2 }); Utilities.TransferToErrorPage(base.OwaContext, LocalizedStrings.GetHtmlEncoded(-226672911), errorDetailedDescription, ThemeFileId.ButtonDialogInfo, true, true); return; } int num = AttachmentHandler.SendDocumentContentToHttpStream(httpContext, this.stream, this.fileName, DocumentEventHandler.CalculateFileExtension(this.fileName), this.contentType); if (this.contentType != null && this.contentType.Equals("application/x-zip-compressed", StringComparison.OrdinalIgnoreCase)) { Utilities.DisableContentEncodingForThisResponse(base.OwaContext.HttpContext.Response); } if (Globals.ArePerfCountersEnabled) { if ((documentLibraryObjectId.UriFlags & UriFlags.Sharepoint) != (UriFlags)0) { OwaSingleCounters.WssBytes.IncrementBy((long)num); OwaSingleCounters.WssRequests.Increment(); return; } if ((documentLibraryObjectId.UriFlags & UriFlags.Unc) != (UriFlags)0) { OwaSingleCounters.UncBytes.IncrementBy((long)num); OwaSingleCounters.UncRequests.Increment(); } } }