Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / Substitution.cs / 1305376 / 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), ] 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ButtonBase.cs
- JapaneseCalendar.cs
- UserControlBuildProvider.cs
- RepeatInfo.cs
- TextTrailingCharacterEllipsis.cs
- XmlExceptionHelper.cs
- GrammarBuilderDictation.cs
- BuilderPropertyEntry.cs
- DbConnectionHelper.cs
- BaseTransportHeaders.cs
- PackageFilter.cs
- BackoffTimeoutHelper.cs
- LoadMessageLogger.cs
- LinearQuaternionKeyFrame.cs
- CompiledXpathExpr.cs
- EdmConstants.cs
- Path.cs
- TextRunCacheImp.cs
- AnnotationComponentManager.cs
- ResourcePool.cs
- SerialErrors.cs
- RegexCompiler.cs
- GridViewUpdateEventArgs.cs
- TemplateKey.cs
- Typography.cs
- DockProviderWrapper.cs
- GeometryCombineModeValidation.cs
- PointAnimationUsingPath.cs
- ProfileServiceManager.cs
- UncommonField.cs
- BorderGapMaskConverter.cs
- SqlFileStream.cs
- Column.cs
- TextBreakpoint.cs
- DataGridViewRowConverter.cs
- TraversalRequest.cs
- WebCategoryAttribute.cs
- Helpers.cs
- DocumentPage.cs
- CollectionType.cs
- DataBindingCollection.cs
- DataColumnPropertyDescriptor.cs
- ByteStreamGeometryContext.cs
- GeneralTransform3DTo2D.cs
- XmlSchemaDocumentation.cs
- ClientFormsAuthenticationMembershipProvider.cs
- NamespaceListProperty.cs
- ValidationError.cs
- Utils.cs
- ModuleBuilder.cs
- DependencyObjectType.cs
- MediaSystem.cs
- _SslState.cs
- XamlFilter.cs
- LoadItemsEventArgs.cs
- CacheAxisQuery.cs
- DocumentAutomationPeer.cs
- EntityException.cs
- MatrixTransform3D.cs
- TargetException.cs
- TreeNodeBinding.cs
- StorageEndPropertyMapping.cs
- TypeInfo.cs
- XmlWriterSettings.cs
- CellTreeNode.cs
- OdbcUtils.cs
- FilterQueryOptionExpression.cs
- WindowsButton.cs
- PersonalizableTypeEntry.cs
- MailHeaderInfo.cs
- CollectionBase.cs
- TreeViewItemAutomationPeer.cs
- TriState.cs
- NavigationPropertyEmitter.cs
- CapabilitiesAssignment.cs
- BufferedConnection.cs
- WebPartExportVerb.cs
- SqlInternalConnectionSmi.cs
- ServiceObjectContainer.cs
- BounceEase.cs
- ToolStripMenuItem.cs
- SelfIssuedAuthRSACryptoProvider.cs
- WindowsGraphicsCacheManager.cs
- TypeInfo.cs
- EncoderExceptionFallback.cs
- DataTemplateKey.cs
- SpecularMaterial.cs
- CodeBlockBuilder.cs
- DeflateStream.cs
- SharedPerformanceCounter.cs
- FontStretches.cs
- BeginStoryboard.cs
- OAVariantLib.cs
- SingleAnimationUsingKeyFrames.cs
- GridViewCancelEditEventArgs.cs
- ObsoleteAttribute.cs
- SqlCacheDependency.cs
- DispatcherProcessingDisabled.cs
- EventLogger.cs
- RSAOAEPKeyExchangeDeformatter.cs