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
- Parser.cs
- MarshalDirectiveException.cs
- IfAction.cs
- EdmComplexPropertyAttribute.cs
- MsmqSecureHashAlgorithm.cs
- PeerNameRegistration.cs
- NamespaceEmitter.cs
- HyperLink.cs
- Converter.cs
- LinqDataSourceHelper.cs
- SourceFilter.cs
- BeginStoryboard.cs
- InheritanceAttribute.cs
- Metafile.cs
- FileUtil.cs
- RegexBoyerMoore.cs
- LocatorGroup.cs
- EditorPartCollection.cs
- DateTime.cs
- TrustLevel.cs
- InterleavedZipPartStream.cs
- SizeAnimationClockResource.cs
- SiteMapNodeItem.cs
- SizeAnimation.cs
- Section.cs
- ScriptingWebServicesSectionGroup.cs
- ConfigurationLocationCollection.cs
- PostBackOptions.cs
- QilBinary.cs
- DesignerObject.cs
- HttpDictionary.cs
- XmlnsDefinitionAttribute.cs
- ToolStripMenuItem.cs
- BCryptSafeHandles.cs
- BigInt.cs
- Funcletizer.cs
- CodeSnippetStatement.cs
- SqlCacheDependencyDatabase.cs
- PatternMatcher.cs
- NotSupportedException.cs
- HttpStreamXmlDictionaryReader.cs
- SafeCryptoKeyHandle.cs
- ObjectListItemCollection.cs
- WebEvents.cs
- EdmError.cs
- TemplateControl.cs
- DataBinding.cs
- DiagnosticsConfigurationHandler.cs
- DataListAutoFormat.cs
- UpdateTracker.cs
- GridItemCollection.cs
- PrintingPermissionAttribute.cs
- XmlSchemaComplexType.cs
- UnionCodeGroup.cs
- DataGridViewSortCompareEventArgs.cs
- WebCategoryAttribute.cs
- ICollection.cs
- Vertex.cs
- SqlMethodAttribute.cs
- XPathMultyIterator.cs
- AnalyzedTree.cs
- RectangleGeometry.cs
- UdpDiscoveryEndpointProvider.cs
- TabControl.cs
- TraceSection.cs
- RequestResizeEvent.cs
- SecurityManager.cs
- Axis.cs
- GlyphingCache.cs
- CodeTypeReferenceCollection.cs
- CacheModeValueSerializer.cs
- CultureNotFoundException.cs
- DataContractSerializer.cs
- PersonalizationStateInfoCollection.cs
- ProtocolsSection.cs
- ChangeInterceptorAttribute.cs
- X509Certificate2Collection.cs
- QualifiedCellIdBoolean.cs
- TypeNameConverter.cs
- ConfigurationLoaderException.cs
- RelationshipEnd.cs
- ZipFileInfoCollection.cs
- ImmComposition.cs
- COM2ExtendedUITypeEditor.cs
- IndexerNameAttribute.cs
- CounterCreationDataCollection.cs
- XmlSortKey.cs
- HttpCachePolicy.cs
- QilExpression.cs
- ChoiceConverter.cs
- TypeConverters.cs
- DescendantOverDescendantQuery.cs
- SettingsAttributeDictionary.cs
- XmlMemberMapping.cs
- CacheVirtualItemsEvent.cs
- StringArrayConverter.cs
- _CommandStream.cs
- WindowsListBox.cs
- PrintPreviewControl.cs
- ButtonBaseAdapter.cs