Code:
/ FX-1434 / FX-1434 / 1.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
- RSAPKCS1SignatureDeformatter.cs
- MenuBase.cs
- PrimitiveCodeDomSerializer.cs
- DocumentScope.cs
- AmbientLight.cs
- CommandManager.cs
- DataExchangeServiceBinder.cs
- ProfilePropertySettings.cs
- DbDataSourceEnumerator.cs
- NavigationWindowAutomationPeer.cs
- Win32.cs
- MemberHolder.cs
- XPathNodeIterator.cs
- RelatedView.cs
- TemplateBuilder.cs
- XmlCDATASection.cs
- RNGCryptoServiceProvider.cs
- AsmxEndpointPickerExtension.cs
- FixedSOMTableRow.cs
- XmlAnyElementAttribute.cs
- RawUIStateInputReport.cs
- CodeConditionStatement.cs
- ToolStripHighContrastRenderer.cs
- TableDetailsRow.cs
- ListControl.cs
- AsymmetricKeyExchangeDeformatter.cs
- RectangleGeometry.cs
- ReadWriteObjectLock.cs
- HyperLinkColumn.cs
- FormattedTextSymbols.cs
- DataTableReader.cs
- ProviderConnectionPoint.cs
- FixedHyperLink.cs
- DataGridViewElement.cs
- TemplateKeyConverter.cs
- BridgeDataRecord.cs
- PropertyMetadata.cs
- SafeNativeMethodsOther.cs
- FontFamilyValueSerializer.cs
- loginstatus.cs
- RegistryKey.cs
- RecordManager.cs
- Timeline.cs
- CheckBoxField.cs
- DeviceSpecific.cs
- WinInetCache.cs
- TrackingStringDictionary.cs
- Int32Rect.cs
- SecurityException.cs
- DrawingContextWalker.cs
- DataGridViewComboBoxCell.cs
- SecurityVerifiedMessage.cs
- FormDocumentDesigner.cs
- PeerEndPoint.cs
- XPathPatternBuilder.cs
- ErrorEventArgs.cs
- returneventsaver.cs
- SqlMetaData.cs
- httpserverutility.cs
- tabpagecollectioneditor.cs
- LinearKeyFrames.cs
- RepeatBehavior.cs
- Types.cs
- DecodeHelper.cs
- SQLString.cs
- DetailsViewInsertedEventArgs.cs
- DetailsViewInsertedEventArgs.cs
- WCFServiceClientProxyGenerator.cs
- RightsManagementEncryptedStream.cs
- AnimationStorage.cs
- ProxyWebPartManagerDesigner.cs
- TemplateApplicationHelper.cs
- GroupLabel.cs
- OpacityConverter.cs
- SiteMapPath.cs
- SqlCacheDependency.cs
- ArcSegment.cs
- ToolStripLabel.cs
- RsaSecurityKey.cs
- TypeGeneratedEventArgs.cs
- TemplatePropertyEntry.cs
- DataSourceCache.cs
- XPathSelfQuery.cs
- LazyLoadBehavior.cs
- RootDesignerSerializerAttribute.cs
- Object.cs
- FormViewDeletedEventArgs.cs
- SchemaImporterExtensionElement.cs
- CroppedBitmap.cs
- BaseTemplateCodeDomTreeGenerator.cs
- ListParaClient.cs
- SectionRecord.cs
- AVElementHelper.cs
- Buffer.cs
- CustomTypeDescriptor.cs
- Facet.cs
- HelpEvent.cs
- PiiTraceSource.cs
- SqlDataSource.cs
- InputReportEventArgs.cs