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
- ValidationSummary.cs
- Color.cs
- ViewManager.cs
- ConfigurationLocationCollection.cs
- DesignerToolboxInfo.cs
- FlowLayout.cs
- AssemblyNameProxy.cs
- RuntimeConfig.cs
- FileDialog_Vista.cs
- EditorAttribute.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- DataPointer.cs
- RIPEMD160.cs
- ByteKeyFrameCollection.cs
- Switch.cs
- BinaryFormatterSinks.cs
- GeneralTransformGroup.cs
- ScrollBarAutomationPeer.cs
- SubclassTypeValidatorAttribute.cs
- Currency.cs
- DragDeltaEventArgs.cs
- PageSettings.cs
- ResolveCompletedEventArgs.cs
- cookieexception.cs
- Point3DConverter.cs
- SemanticResultKey.cs
- HttpResponseInternalWrapper.cs
- SqlTriggerContext.cs
- RowUpdatingEventArgs.cs
- ForeignConstraint.cs
- FullTrustAssembly.cs
- EtwProvider.cs
- RichTextBox.cs
- XhtmlBasicFormAdapter.cs
- RequestQueryParser.cs
- DefaultClaimSet.cs
- OneOf.cs
- SqlTypesSchemaImporter.cs
- AuthenticationConfig.cs
- DLinqColumnProvider.cs
- ToolStripLabel.cs
- AspNetRouteServiceHttpHandler.cs
- TypeLoadException.cs
- CssStyleCollection.cs
- WebSysDefaultValueAttribute.cs
- SiteMapDataSourceView.cs
- SimpleLine.cs
- MessageUtil.cs
- NonBatchDirectoryCompiler.cs
- QilXmlWriter.cs
- SQLString.cs
- WebPartMenu.cs
- ExtenderControl.cs
- FormDesigner.cs
- ItemCheckEvent.cs
- HttpProtocolImporter.cs
- TableParagraph.cs
- GraphicsState.cs
- UncommonField.cs
- AmbientLight.cs
- EntitySetBaseCollection.cs
- PackagePartCollection.cs
- XmlSchemaSimpleContentExtension.cs
- ContentElement.cs
- FileDetails.cs
- EventManager.cs
- DataGridViewRowPrePaintEventArgs.cs
- SQLDoubleStorage.cs
- ContextMenuService.cs
- ArrayExtension.cs
- Compiler.cs
- MiniConstructorInfo.cs
- FileRecordSequenceHelper.cs
- BooleanExpr.cs
- DesignerAdapterUtil.cs
- SqlServices.cs
- SoundPlayer.cs
- EdmTypeAttribute.cs
- QueryContinueDragEventArgs.cs
- SizeConverter.cs
- XmlSerializer.cs
- DataGridViewRowStateChangedEventArgs.cs
- wmiprovider.cs
- PropertyStore.cs
- Slider.cs
- RoleGroup.cs
- IncrementalCompileAnalyzer.cs
- Identity.cs
- XPathMultyIterator.cs
- ToolStripItemRenderEventArgs.cs
- AttributeSetAction.cs
- BamlLocalizationDictionary.cs
- Interlocked.cs
- SafeFileMappingHandle.cs
- IisTraceListener.cs
- EventData.cs
- ContainerSelectorGlyph.cs
- CompositeActivityCodeGenerator.cs
- ObjectReaderCompiler.cs
- MailWriter.cs