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
- Pair.cs
- EventDescriptorCollection.cs
- PeerNameRegistration.cs
- SqlUserDefinedTypeAttribute.cs
- Group.cs
- FixedDocument.cs
- MemoryMappedViewAccessor.cs
- AppearanceEditorPart.cs
- SqlDesignerDataSourceView.cs
- Int16AnimationBase.cs
- EntitySqlQueryCacheKey.cs
- BaseDataListDesigner.cs
- XmlSchemaDocumentation.cs
- EntityKey.cs
- ConnectAlgorithms.cs
- DataGridRowsPresenter.cs
- UnsafeNativeMethods.cs
- WebPartEditorOkVerb.cs
- HostedBindingBehavior.cs
- XPathScanner.cs
- ContentPropertyAttribute.cs
- ReaderOutput.cs
- BamlLocalizer.cs
- BevelBitmapEffect.cs
- ThousandthOfEmRealDoubles.cs
- TrackingLocationCollection.cs
- WCFServiceClientProxyGenerator.cs
- PolyBezierSegmentFigureLogic.cs
- PauseStoryboard.cs
- ObsoleteAttribute.cs
- AudioDeviceOut.cs
- DynamicMethod.cs
- RootContext.cs
- FormsAuthenticationUserCollection.cs
- CqlLexer.cs
- SystemKeyConverter.cs
- FilterableAttribute.cs
- MetadataUtilsSmi.cs
- PublishLicense.cs
- WebPartZoneCollection.cs
- SmtpException.cs
- KeyEventArgs.cs
- ChameleonKey.cs
- ReferencedAssembly.cs
- TrackingServices.cs
- control.ime.cs
- AlphabetConverter.cs
- PageBuildProvider.cs
- CharUnicodeInfo.cs
- DLinqColumnProvider.cs
- AutoGeneratedFieldProperties.cs
- WpfWebRequestHelper.cs
- X509PeerCertificateAuthentication.cs
- UnsafeCollabNativeMethods.cs
- SecurityAccessDeniedException.cs
- EditorPart.cs
- Margins.cs
- FontFamilyValueSerializer.cs
- cookieexception.cs
- XmlDataProvider.cs
- PanelContainerDesigner.cs
- IndependentAnimationStorage.cs
- ClientUtils.cs
- TransformGroup.cs
- SqlMethodAttribute.cs
- WindowsAuthenticationEventArgs.cs
- ObjectQueryExecutionPlan.cs
- FrameworkElementAutomationPeer.cs
- Timer.cs
- UrlAuthorizationModule.cs
- ControlTemplate.cs
- LassoSelectionBehavior.cs
- DataKey.cs
- SudsParser.cs
- SafePEFileHandle.cs
- DataGridPagerStyle.cs
- NetworkInformationPermission.cs
- FormatException.cs
- ZoneButton.cs
- DecoderFallbackWithFailureFlag.cs
- NavigationHelper.cs
- ReadOnlyDictionary.cs
- CrossContextChannel.cs
- DrawingGroup.cs
- GridLength.cs
- SmiEventStream.cs
- XmlCDATASection.cs
- UpdatePanelTriggerCollection.cs
- InputLangChangeEvent.cs
- Trace.cs
- DefaultCommandConverter.cs
- XmlDigitalSignatureProcessor.cs
- TreeViewDesigner.cs
- InputLangChangeEvent.cs
- SplayTreeNode.cs
- ListView.cs
- PublisherIdentityPermission.cs
- TextSchema.cs
- NavigationHelper.cs
- Point3DValueSerializer.cs