1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
//------------------------------------------------------------------------------
// <copyright file="TraceSection.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.Configuration {
using System;
using System.Xml;
using System.Configuration;
using System.Collections.Specialized;
using System.Collections;
using System.IO;
using System.Text;
using System.Security.Permissions;
/* <!--
trace Attributes:
enabled="[true|false]" - Enable application tracing
localOnly="[true|false]" - View trace results from localhost only
pageOutput="[true|false]" - Display trace ouput on individual pages
requestLimit="[number]" - Number of trace results available in trace.axd
traceMode="[SortByTime|SortByCategory]" - Sorts trace result displays based on Time or Category
-->
<trace
enabled="false"
localOnly="true"
pageOutput="false"
requestLimit="10"
traceMode="SortByTime"
/>
*/
public sealed class TraceSection : ConfigurationSection {
private static ConfigurationPropertyCollection _properties;
private static readonly ConfigurationProperty _propEnabled =
new ConfigurationProperty("enabled",
typeof(bool),
false,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propLocalOnly =
new ConfigurationProperty("localOnly",
typeof(bool),
true,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propMostRecent =
new ConfigurationProperty("mostRecent",
typeof(bool),
false,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propPageOutput =
new ConfigurationProperty("pageOutput",
typeof(bool),
false,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propRequestLimit =
new ConfigurationProperty("requestLimit",
typeof(int),
10,
null,
StdValidatorsAndConverters.PositiveIntegerValidator,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propMode =
new ConfigurationProperty("traceMode",
typeof(TraceDisplayMode),
TraceDisplayMode.SortByTime,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _writeToDiagnosticTrace =
new ConfigurationProperty("writeToDiagnosticsTrace",
typeof(bool),
false,
ConfigurationPropertyOptions.None);
static TraceSection() {
// Property initialization
_properties = new ConfigurationPropertyCollection();
_properties.Add(_propEnabled);
_properties.Add(_propLocalOnly);
_properties.Add(_propMostRecent);
_properties.Add(_propPageOutput);
_properties.Add(_propRequestLimit);
_properties.Add(_propMode);
_properties.Add(_writeToDiagnosticTrace);
}
public TraceSection() {
}
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("enabled", DefaultValue = false)]
public bool Enabled {
get {
return (bool)base[_propEnabled];
}
set {
base[_propEnabled] = value;
}
}
[ConfigurationProperty("mostRecent", DefaultValue = false)]
public bool MostRecent {
get {
return (bool)base[_propMostRecent];
}
set {
base[_propMostRecent] = value;
}
}
[ConfigurationProperty("localOnly", DefaultValue = true)]
public bool LocalOnly {
get {
return (bool)base[_propLocalOnly];
}
set {
base[_propLocalOnly] = value;
}
}
[ConfigurationProperty("pageOutput", DefaultValue = false)]
public bool PageOutput {
get {
return (bool)base[_propPageOutput];
}
set {
base[_propPageOutput] = value;
}
}
[ConfigurationProperty("requestLimit", DefaultValue = 10)]
[IntegerValidator(MinValue = 0)]
public int RequestLimit {
get {
return (int)base[_propRequestLimit];
}
set {
base[_propRequestLimit] = value;
}
}
[ConfigurationProperty("traceMode", DefaultValue = TraceDisplayMode.SortByTime)]
public TraceDisplayMode TraceMode {
get {
return (TraceDisplayMode)base[_propMode];
}
set {
base[_propMode] = value;
}
}
[ConfigurationProperty("writeToDiagnosticsTrace", DefaultValue = false)]
public bool WriteToDiagnosticsTrace {
get {
return (bool)base[_writeToDiagnosticTrace];
}
set {
base[_writeToDiagnosticTrace] = value;
}
}
}
}
|