Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Configuration / TagPrefixInfo.cs / 2 / TagPrefixInfo.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
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.Web.Util;
using System.Web.UI;
using System.Web.Compilation;
using System.Threading;
using System.Web.Configuration;
using System.Security.Permissions;
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class TagPrefixInfo : ConfigurationElement {
private static readonly ConfigurationElementProperty s_elemProperty =
new ConfigurationElementProperty(new CallbackValidator(typeof(TagPrefixInfo), Validate));
private static ConfigurationPropertyCollection _properties;
private static readonly ConfigurationProperty _propTagPrefix =
new ConfigurationProperty("tagPrefix",
typeof(string),
"/",
null,
StdValidatorsAndConverters.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired);
private static readonly ConfigurationProperty _propTagName =
new ConfigurationProperty("tagName",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propNamespace =
new ConfigurationProperty("namespace",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propAssembly =
new ConfigurationProperty("assembly",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propSource =
new ConfigurationProperty("src",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
static TagPrefixInfo() {
_properties = new ConfigurationPropertyCollection();
_properties.Add(_propTagPrefix);
_properties.Add(_propTagName);
_properties.Add(_propNamespace);
_properties.Add(_propAssembly);
_properties.Add(_propSource);
}
internal TagPrefixInfo() {
}
public TagPrefixInfo(String tagPrefix, String nameSpace, String assembly, String tagName, String source)
: this() {
TagPrefix = tagPrefix;
Namespace = nameSpace;
Assembly = assembly;
TagName = tagName;
Source = source;
}
public override bool Equals(object prefix) {
TagPrefixInfo ns = prefix as TagPrefixInfo;
return StringUtil.Equals(TagPrefix, ns.TagPrefix) &&
StringUtil.Equals(TagName, ns.TagName) &&
StringUtil.Equals(Namespace, ns.Namespace) &&
StringUtil.Equals(Assembly, ns.Assembly) &&
StringUtil.Equals(Source, ns.Source);
}
public override int GetHashCode() {
return TagPrefix.GetHashCode() ^ TagName.GetHashCode() ^
Namespace.GetHashCode() ^ Assembly.GetHashCode() ^
Source.GetHashCode();
}
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("tagPrefix", IsRequired = true, DefaultValue = "/")]
[StringValidator(MinLength = 1)]
public string TagPrefix {
get {
return (string)base[_propTagPrefix];
}
set {
base[_propTagPrefix] = value;
}
}
[ConfigurationProperty("tagName")]
public string TagName {
get {
return (string)base[_propTagName];
}
set {
base[_propTagName] = value;
}
}
[ConfigurationProperty("namespace")]
public string Namespace {
get {
return (string)base[_propNamespace];
}
set {
base[_propNamespace] = value;
}
}
[ConfigurationProperty("assembly")]
public string Assembly {
get {
return (string)base[_propAssembly];
}
set {
base[_propAssembly] = value;
}
}
[ConfigurationProperty("src")]
public string Source {
get {
return (string)base[_propSource];
}
set {
if (!String.IsNullOrEmpty(value)) {
base[_propSource] = value;
}
else {
base[_propSource] = null;
}
}
}
protected override ConfigurationElementProperty ElementProperty {
get {
return s_elemProperty;
}
}
private static void Validate(object value) {
if (value == null) {
throw new ArgumentNullException("control");
}
TagPrefixInfo elem = (TagPrefixInfo)value;
if (System.Web.UI.Util.ContainsWhiteSpace(elem.TagPrefix)) {
throw new ConfigurationErrorsException(
SR.GetString(SR.Space_attribute, "tagPrefix"));
}
bool invalid = false;
if (!String.IsNullOrEmpty(elem.Namespace)) {
// It is a custom control
if (!(String.IsNullOrEmpty(elem.TagName) && String.IsNullOrEmpty(elem.Source))) {
invalid = true;
}
}
else if (!String.IsNullOrEmpty(elem.TagName)) {
// It is a user control
if (!(String.IsNullOrEmpty(elem.Namespace) &&
String.IsNullOrEmpty(elem.Assembly) &&
!String.IsNullOrEmpty(elem.Source))) {
invalid = true;
}
}
else {
invalid = true;
}
if (invalid) {
throw new ConfigurationErrorsException(
SR.GetString(SR.Invalid_tagprefix_entry));
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
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.Web.Util;
using System.Web.UI;
using System.Web.Compilation;
using System.Threading;
using System.Web.Configuration;
using System.Security.Permissions;
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class TagPrefixInfo : ConfigurationElement {
private static readonly ConfigurationElementProperty s_elemProperty =
new ConfigurationElementProperty(new CallbackValidator(typeof(TagPrefixInfo), Validate));
private static ConfigurationPropertyCollection _properties;
private static readonly ConfigurationProperty _propTagPrefix =
new ConfigurationProperty("tagPrefix",
typeof(string),
"/",
null,
StdValidatorsAndConverters.NonEmptyStringValidator,
ConfigurationPropertyOptions.IsRequired);
private static readonly ConfigurationProperty _propTagName =
new ConfigurationProperty("tagName",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propNamespace =
new ConfigurationProperty("namespace",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propAssembly =
new ConfigurationProperty("assembly",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
private static readonly ConfigurationProperty _propSource =
new ConfigurationProperty("src",
typeof(string),
String.Empty,
null,
null,
ConfigurationPropertyOptions.None);
static TagPrefixInfo() {
_properties = new ConfigurationPropertyCollection();
_properties.Add(_propTagPrefix);
_properties.Add(_propTagName);
_properties.Add(_propNamespace);
_properties.Add(_propAssembly);
_properties.Add(_propSource);
}
internal TagPrefixInfo() {
}
public TagPrefixInfo(String tagPrefix, String nameSpace, String assembly, String tagName, String source)
: this() {
TagPrefix = tagPrefix;
Namespace = nameSpace;
Assembly = assembly;
TagName = tagName;
Source = source;
}
public override bool Equals(object prefix) {
TagPrefixInfo ns = prefix as TagPrefixInfo;
return StringUtil.Equals(TagPrefix, ns.TagPrefix) &&
StringUtil.Equals(TagName, ns.TagName) &&
StringUtil.Equals(Namespace, ns.Namespace) &&
StringUtil.Equals(Assembly, ns.Assembly) &&
StringUtil.Equals(Source, ns.Source);
}
public override int GetHashCode() {
return TagPrefix.GetHashCode() ^ TagName.GetHashCode() ^
Namespace.GetHashCode() ^ Assembly.GetHashCode() ^
Source.GetHashCode();
}
protected override ConfigurationPropertyCollection Properties {
get {
return _properties;
}
}
[ConfigurationProperty("tagPrefix", IsRequired = true, DefaultValue = "/")]
[StringValidator(MinLength = 1)]
public string TagPrefix {
get {
return (string)base[_propTagPrefix];
}
set {
base[_propTagPrefix] = value;
}
}
[ConfigurationProperty("tagName")]
public string TagName {
get {
return (string)base[_propTagName];
}
set {
base[_propTagName] = value;
}
}
[ConfigurationProperty("namespace")]
public string Namespace {
get {
return (string)base[_propNamespace];
}
set {
base[_propNamespace] = value;
}
}
[ConfigurationProperty("assembly")]
public string Assembly {
get {
return (string)base[_propAssembly];
}
set {
base[_propAssembly] = value;
}
}
[ConfigurationProperty("src")]
public string Source {
get {
return (string)base[_propSource];
}
set {
if (!String.IsNullOrEmpty(value)) {
base[_propSource] = value;
}
else {
base[_propSource] = null;
}
}
}
protected override ConfigurationElementProperty ElementProperty {
get {
return s_elemProperty;
}
}
private static void Validate(object value) {
if (value == null) {
throw new ArgumentNullException("control");
}
TagPrefixInfo elem = (TagPrefixInfo)value;
if (System.Web.UI.Util.ContainsWhiteSpace(elem.TagPrefix)) {
throw new ConfigurationErrorsException(
SR.GetString(SR.Space_attribute, "tagPrefix"));
}
bool invalid = false;
if (!String.IsNullOrEmpty(elem.Namespace)) {
// It is a custom control
if (!(String.IsNullOrEmpty(elem.TagName) && String.IsNullOrEmpty(elem.Source))) {
invalid = true;
}
}
else if (!String.IsNullOrEmpty(elem.TagName)) {
// It is a user control
if (!(String.IsNullOrEmpty(elem.Namespace) &&
String.IsNullOrEmpty(elem.Assembly) &&
!String.IsNullOrEmpty(elem.Source))) {
invalid = true;
}
}
else {
invalid = true;
}
if (invalid) {
throw new ConfigurationErrorsException(
SR.GetString(SR.Invalid_tagprefix_entry));
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- X509Certificate2.cs
- Rules.cs
- BitmapCodecInfo.cs
- XmlSchemas.cs
- MaterialGroup.cs
- TextViewDesigner.cs
- AssemblyInfo.cs
- CodeTypeReference.cs
- ConfigurationProperty.cs
- RawUIStateInputReport.cs
- DataGridViewCellFormattingEventArgs.cs
- SimpleWorkerRequest.cs
- DataErrorValidationRule.cs
- ListViewInsertionMark.cs
- PlatformCulture.cs
- DbConnectionClosed.cs
- DataGridViewRowsAddedEventArgs.cs
- XsltLibrary.cs
- ByteBufferPool.cs
- UIElement3DAutomationPeer.cs
- RuleSettingsCollection.cs
- AttributeQuery.cs
- AddInServer.cs
- Utils.cs
- ServiceDescription.cs
- WebPartConnection.cs
- TemplatedEditableDesignerRegion.cs
- Parser.cs
- Int32Converter.cs
- SystemException.cs
- GridView.cs
- DbProviderSpecificTypePropertyAttribute.cs
- IndexedEnumerable.cs
- GregorianCalendar.cs
- WpfPayload.cs
- SQLByteStorage.cs
- EllipseGeometry.cs
- smtpconnection.cs
- ScrollBar.cs
- XmlSchemas.cs
- CopyOfAction.cs
- RegexReplacement.cs
- Transform3D.cs
- InternalTransaction.cs
- ProtocolElement.cs
- SimpleApplicationHost.cs
- RichTextBox.cs
- ILGenerator.cs
- UndoUnit.cs
- SecurityUtils.cs
- Wildcard.cs
- ConstraintCollection.cs
- RetrieveVirtualItemEventArgs.cs
- SerialPinChanges.cs
- EnlistmentTraceIdentifier.cs
- CacheAxisQuery.cs
- XmlAggregates.cs
- InvalidDataException.cs
- ControlDesigner.cs
- TemplateLookupAction.cs
- CqlParserHelpers.cs
- FrameworkContentElementAutomationPeer.cs
- FlowPosition.cs
- UInt32.cs
- MoveSizeWinEventHandler.cs
- SortQuery.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- DataGridViewTextBoxEditingControl.cs
- WindowsListViewSubItem.cs
- ToolstripProfessionalRenderer.cs
- Vector3DAnimationUsingKeyFrames.cs
- DeliveryStrategy.cs
- DesignerActionItem.cs
- WindowsTab.cs
- ListSourceHelper.cs
- NavigationHelper.cs
- formatter.cs
- UnsafeNativeMethods.cs
- CodeThrowExceptionStatement.cs
- WebPartMenuStyle.cs
- ScrollBar.cs
- NumericUpDown.cs
- FrameSecurityDescriptor.cs
- webeventbuffer.cs
- Parser.cs
- RepeaterCommandEventArgs.cs
- OdbcCommandBuilder.cs
- WebHeaderCollection.cs
- SecurityDescriptor.cs
- PrePrepareMethodAttribute.cs
- SQLBytes.cs
- HMACSHA1.cs
- TableChangeProcessor.cs
- SafeNativeMethods.cs
- XmlSchemaComplexType.cs
- HtmlMeta.cs
- TextViewDesigner.cs
- COSERVERINFO.cs
- AppDomainShutdownMonitor.cs
- SchemaImporterExtensionElementCollection.cs