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
- HttpHandlerAction.cs
- TimeStampChecker.cs
- Shared.cs
- DataColumnPropertyDescriptor.cs
- EditorPartDesigner.cs
- Select.cs
- AsymmetricKeyExchangeDeformatter.cs
- XPathParser.cs
- CryptoKeySecurity.cs
- SplineKeyFrames.cs
- SessionStateItemCollection.cs
- XmlWhitespace.cs
- HierarchicalDataBoundControlAdapter.cs
- TogglePatternIdentifiers.cs
- CurrentChangedEventManager.cs
- ListSurrogate.cs
- TabletCollection.cs
- SmtpLoginAuthenticationModule.cs
- InputReferenceExpression.cs
- GeometryValueSerializer.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- DescendantOverDescendantQuery.cs
- ToolStripOverflow.cs
- CompleteWizardStep.cs
- WebBrowserNavigatingEventHandler.cs
- WindowsProgressbar.cs
- PerformanceCounterPermission.cs
- XmlIgnoreAttribute.cs
- Int32AnimationBase.cs
- coordinator.cs
- SqlClientWrapperSmiStreamChars.cs
- DataContractJsonSerializer.cs
- ConsumerConnectionPoint.cs
- AddingNewEventArgs.cs
- DefaultPropertyAttribute.cs
- EdmToObjectNamespaceMap.cs
- ToolStripGrip.cs
- ContentPresenter.cs
- XmlSubtreeReader.cs
- CheckBoxList.cs
- TableLayoutSettingsTypeConverter.cs
- DefaultPerformanceCounters.cs
- XmlHierarchicalEnumerable.cs
- SafeUserTokenHandle.cs
- AuthenticationModulesSection.cs
- Unit.cs
- _Events.cs
- Pts.cs
- XmlWriter.cs
- counter.cs
- TypeHelper.cs
- webbrowsersite.cs
- Compiler.cs
- xmlglyphRunInfo.cs
- BulletDecorator.cs
- Separator.cs
- PointCollection.cs
- WsdlInspector.cs
- Link.cs
- GridViewCellAutomationPeer.cs
- IndependentlyAnimatedPropertyMetadata.cs
- HandleCollector.cs
- KeyedQueue.cs
- ServiceProviders.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- ISessionStateStore.cs
- SystemWebCachingSectionGroup.cs
- WindowsToolbarAsMenu.cs
- Internal.cs
- FileCodeGroup.cs
- FixedTextContainer.cs
- ExpressionPrefixAttribute.cs
- HotSpotCollection.cs
- GridViewColumnHeaderAutomationPeer.cs
- LogArchiveSnapshot.cs
- ProjectedWrapper.cs
- MessageSmuggler.cs
- ModelTypeConverter.cs
- MenuItemCollectionEditor.cs
- LongTypeConverter.cs
- WarningException.cs
- WindowsFormsSectionHandler.cs
- TrustManagerMoreInformation.cs
- CombinedGeometry.cs
- SiteOfOriginContainer.cs
- DataControlField.cs
- PersistChildrenAttribute.cs
- SafeNativeMethods.cs
- TripleDESCryptoServiceProvider.cs
- MailWebEventProvider.cs
- SchemaTableColumn.cs
- ResXBuildProvider.cs
- Variable.cs
- SharedUtils.cs
- XmlSchemaSimpleTypeList.cs
- WpfWebRequestHelper.cs
- Timer.cs
- PerfCounterSection.cs
- LinqExpressionNormalizer.cs
- MetadataItemEmitter.cs