Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / WebPageTraceListener.cs / 1 / WebPageTraceListener.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Web; using System.Web.UI; using System.Diagnostics; using System.Globalization; using System.Security.Permissions; namespace System.Web { [HostProtection(Synchronization=true)] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class WebPageTraceListener : TraceListener { public WebPageTraceListener() { } // the listener apis public override void Write(string message) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(message, false); } public override void Write(string message, string category) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(category, message, false); } public override void WriteLine(string message) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(message, false); } public override void WriteLine(string message, string category) { if (Filter != null && !Filter.ShouldTrace(null, String.Empty, TraceEventType.Verbose, 0, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context != null) context.Trace.WriteInternal(category, message, false); } public override void TraceEvent(TraceEventCache eventCache, String source, TraceEventType severity, int id, string message) { if (Filter != null && !Filter.ShouldTrace(eventCache, source, severity, id, message, null, null, null)) return; HttpContext context = HttpContext.Current; if (context == null) return; string messagestring = SR.GetString(SR.WebPageTraceListener_Event) + " " + id + ": " + message; if (severity <= TraceEventType.Warning) context.Trace.WarnInternal(source, messagestring, false); else context.Trace.WriteInternal(source, messagestring, false); } public override void TraceEvent(TraceEventCache eventCache, String source, TraceEventType severity, int id, string format, params object[] args) { TraceEvent(eventCache, source, severity, id, String.Format(CultureInfo.InvariantCulture, format, args)); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Italic.cs
- BrowserDefinition.cs
- SequenceDesigner.cs
- TripleDESCryptoServiceProvider.cs
- Decoder.cs
- HashFinalRequest.cs
- CachedPathData.cs
- Task.cs
- ByteAnimationBase.cs
- SessionParameter.cs
- EventArgs.cs
- PrintEvent.cs
- TextElementCollection.cs
- GenericAuthenticationEventArgs.cs
- BuildManagerHost.cs
- SamlSubject.cs
- SharedStatics.cs
- ReadOnlyHierarchicalDataSourceView.cs
- MappingMetadataHelper.cs
- UtilityExtension.cs
- _SslState.cs
- ConfigXmlComment.cs
- CodeVariableReferenceExpression.cs
- ControlUtil.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- OutputCacheModule.cs
- HtmlHistory.cs
- SafeRightsManagementPubHandle.cs
- ParameterModifier.cs
- RawUIStateInputReport.cs
- ParallelForEach.cs
- ThreadExceptionEvent.cs
- UIElement3D.cs
- ConstantCheck.cs
- ThreadExceptionDialog.cs
- LambdaCompiler.cs
- DesignerEditorPartChrome.cs
- DownloadProgressEventArgs.cs
- Overlapped.cs
- WebBrowserDocumentCompletedEventHandler.cs
- FlowDocumentPage.cs
- EventLogPermissionEntryCollection.cs
- XmlChoiceIdentifierAttribute.cs
- MSAAWinEventWrap.cs
- BuildProviderUtils.cs
- ClearTypeHintValidation.cs
- SchemaAttDef.cs
- FormViewCommandEventArgs.cs
- ScrollEvent.cs
- SqlClientWrapperSmiStreamChars.cs
- TrustManagerPromptUI.cs
- FtpRequestCacheValidator.cs
- EventBuilder.cs
- Stroke.cs
- ExpressionBinding.cs
- COMException.cs
- ChangeProcessor.cs
- SmtpMail.cs
- OperatingSystem.cs
- DesignerTransaction.cs
- SafeLibraryHandle.cs
- DockingAttribute.cs
- NavigateUrlConverter.cs
- GraphicsContainer.cs
- compensatingcollection.cs
- DataGridViewCellValidatingEventArgs.cs
- SystemBrushes.cs
- IODescriptionAttribute.cs
- LocalizationParserHooks.cs
- StreamingContext.cs
- ValidationSummary.cs
- ItemsChangedEventArgs.cs
- DropShadowBitmapEffect.cs
- CopyEncoder.cs
- KeySpline.cs
- ClientSettings.cs
- EntityDesignerUtils.cs
- PostBackTrigger.cs
- Trigger.cs
- WindowProviderWrapper.cs
- DeclaredTypeElement.cs
- BrowserDefinition.cs
- Blend.cs
- ContentPresenter.cs
- StrokeFIndices.cs
- GroupItemAutomationPeer.cs
- XsltOutput.cs
- Duration.cs
- TextBoxDesigner.cs
- FontSizeConverter.cs
- ToolStripOverflowButton.cs
- GenericEnumConverter.cs
- ApplicationDirectory.cs
- FileUpload.cs
- CustomTypeDescriptor.cs
- SmtpNtlmAuthenticationModule.cs
- TextServicesHost.cs
- HtmlInputImage.cs
- EventDescriptor.cs
- ArrayItemReference.cs