Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / Substitution.cs / 1 / Substitution.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.ComponentModel; using System.Globalization; using System.Security.Permissions; using System.Web; using System.Web.UI; ////// [ DefaultProperty("MethodName"), Designer("System.Web.UI.Design.WebControls.SubstitutionDesigner, " + AssemblyRef.SystemDesign), ParseChildren(true), PersistChildren(false), ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class Substitution : Control { ////// /// public Substitution() { } ////// /// [ DefaultValue(""), WebCategory("Behavior"), WebSysDescription(SR.Substitution_MethodNameDescr) ] public virtual string MethodName { get { string s = ViewState["MethodName"] as string; return s == null? String.Empty : s; } set { ViewState["MethodName"] = value; } } protected override ControlCollection CreateControlCollection() { return new EmptyControlCollection(this); } // SECURITY CODE // VSWhidbey 253188: Permission assert to support page running below full trust [ReflectionPermission(SecurityAction.Assert, Flags=ReflectionPermissionFlag.MemberAccess)] private HttpResponseSubstitutionCallback GetDelegate(Type targetType, string methodName) { return (HttpResponseSubstitutionCallback)Delegate.CreateDelegate( typeof(HttpResponseSubstitutionCallback), targetType, methodName); } protected internal override void OnPreRender(EventArgs e) { base.OnPreRender(e); // VSWhidbey 84748: Temp fix, throw if we are within a cached control Control parent = Parent; while (parent != null) { if (parent is BasePartialCachingControl) { throw new HttpException( SR.GetString(SR.Substitution_CannotBeInCachedControl)); } parent = parent.Parent; } } protected internal override void Render(HtmlTextWriter writer) { RenderMarkup(writer); } internal void RenderMarkup(HtmlTextWriter writer) { if (MethodName.Length == 0) { return; } TemplateControl target = TemplateControl; if (target == null) { return; } // get the delegate to the method HttpResponseSubstitutionCallback callback = null; try { callback = GetDelegate(target.GetType(), MethodName); } catch { } if (callback == null) { throw new HttpException( SR.GetString(SR.Substitution_BadMethodName, MethodName)); } // add the substitution to the response Page.Response.WriteSubstitution(callback); } } }///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FontStretchConverter.cs
- TypeUtil.cs
- MachineKeyConverter.cs
- LogLogRecordHeader.cs
- TraceHwndHost.cs
- HtmlInputReset.cs
- RNGCryptoServiceProvider.cs
- XmlSchemaSimpleTypeList.cs
- isolationinterop.cs
- SetIterators.cs
- DataGridViewRowCollection.cs
- NativeCppClassAttribute.cs
- IndexerNameAttribute.cs
- ProviderMetadata.cs
- Vector.cs
- Image.cs
- ObjectDataSourceDisposingEventArgs.cs
- TableCellCollection.cs
- Opcode.cs
- DataSysAttribute.cs
- TransportReplyChannelAcceptor.cs
- DataGridViewCellStyle.cs
- InstanceDataCollection.cs
- EqualityArray.cs
- ISO2022Encoding.cs
- ElapsedEventArgs.cs
- StreamSecurityUpgradeProvider.cs
- DesignSurfaceManager.cs
- IssuedSecurityTokenParameters.cs
- COAUTHIDENTITY.cs
- AssociationType.cs
- SecurityUtils.cs
- EntityContainer.cs
- DoubleLink.cs
- WebBrowserBase.cs
- OletxTransactionFormatter.cs
- SiteMembershipCondition.cs
- ServiceEndpoint.cs
- SqlDependencyUtils.cs
- DataServiceExpressionVisitor.cs
- TextFormatterHost.cs
- TextServicesProperty.cs
- TimeSpanConverter.cs
- TableLayoutStyle.cs
- securestring.cs
- PieceNameHelper.cs
- ColumnResult.cs
- Span.cs
- EditorAttribute.cs
- TextRunCache.cs
- LiteralControl.cs
- BrowserCapabilitiesFactoryBase.cs
- ViewKeyConstraint.cs
- MatrixIndependentAnimationStorage.cs
- TlsSspiNegotiation.cs
- HttpHeaderCollection.cs
- ModuleElement.cs
- Int32RectConverter.cs
- NamespaceList.cs
- DataRecordInternal.cs
- MergePropertyDescriptor.cs
- DataServiceSaveChangesEventArgs.cs
- DesignerDataTableBase.cs
- Operand.cs
- ChameleonKey.cs
- SQLInt64Storage.cs
- TransformedBitmap.cs
- Sequence.cs
- FontFamilyConverter.cs
- SoapAttributeOverrides.cs
- OracleLob.cs
- _Events.cs
- MetabaseReader.cs
- XmlReaderSettings.cs
- TextSelectionHelper.cs
- ObjectDataSourceView.cs
- BindValidationContext.cs
- Utils.cs
- HtmlShimManager.cs
- TextSegment.cs
- RoutedEventConverter.cs
- tooltip.cs
- TreeNodeStyleCollection.cs
- nulltextnavigator.cs
- MatrixAnimationUsingPath.cs
- SubstitutionList.cs
- HttpCachePolicyElement.cs
- DataQuery.cs
- XmlComment.cs
- ErrorRuntimeConfig.cs
- QilDataSource.cs
- WebPartManagerInternals.cs
- Merger.cs
- InfoCardBaseException.cs
- OutputCacheSettings.cs
- LinqMaximalSubtreeNominator.cs
- TypeViewSchema.cs
- TextReader.cs
- PriorityQueue.cs
- DependencyObjectProvider.cs