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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Bold.cs
- AsyncPostBackErrorEventArgs.cs
- XmlException.cs
- ProcessHostConfigUtils.cs
- FileVersion.cs
- GridEntryCollection.cs
- TimeZoneInfo.cs
- ExplicitDiscriminatorMap.cs
- LOSFormatter.cs
- FontFamily.cs
- QueryStatement.cs
- NameValueConfigurationElement.cs
- SQLByteStorage.cs
- LongTypeConverter.cs
- SqlConnectionPoolGroupProviderInfo.cs
- HMAC.cs
- SiteMapProvider.cs
- CheckedListBox.cs
- DictionaryMarkupSerializer.cs
- DbMetaDataColumnNames.cs
- NeutralResourcesLanguageAttribute.cs
- SystemSounds.cs
- WindowManager.cs
- While.cs
- TextServicesLoader.cs
- ConfigDefinitionUpdates.cs
- GridViewCommandEventArgs.cs
- Speller.cs
- OdbcConnection.cs
- WindowExtensionMethods.cs
- SystemThemeKey.cs
- FixedTextPointer.cs
- Positioning.cs
- AsymmetricSignatureFormatter.cs
- ExtenderProvidedPropertyAttribute.cs
- AutomationFocusChangedEventArgs.cs
- SchemaMerger.cs
- HeaderedItemsControl.cs
- Trigger.cs
- DbDataRecord.cs
- Base64Decoder.cs
- ExtenderProvidedPropertyAttribute.cs
- WmpBitmapDecoder.cs
- GlobalizationSection.cs
- AttributeParameterInfo.cs
- FocusWithinProperty.cs
- BitVector32.cs
- PreviewPrintController.cs
- OutputCacheSection.cs
- ColorContextHelper.cs
- RIPEMD160Managed.cs
- MergeFilterQuery.cs
- rsa.cs
- TextEndOfSegment.cs
- BamlStream.cs
- Crypto.cs
- StartFileNameEditor.cs
- Rect.cs
- FileDialog.cs
- DrawListViewColumnHeaderEventArgs.cs
- InterleavedZipPartStream.cs
- BinaryReader.cs
- CloseSequenceResponse.cs
- DBCommandBuilder.cs
- IdentityNotMappedException.cs
- FontFamilyIdentifier.cs
- AxImporter.cs
- XmlSchemaGroupRef.cs
- OptimalBreakSession.cs
- RemoveFromCollection.cs
- NonPrimarySelectionGlyph.cs
- SigningProgress.cs
- PeerPresenceInfo.cs
- AutomationProperties.cs
- ObjectStateManager.cs
- DrawingCollection.cs
- SafeEventLogReadHandle.cs
- FrameworkElement.cs
- DoubleAnimationUsingKeyFrames.cs
- RouteData.cs
- PresentationAppDomainManager.cs
- MemberPath.cs
- StylusPointPropertyId.cs
- Rect3D.cs
- BoolExpression.cs
- GeneratedCodeAttribute.cs
- XmlHelper.cs
- Math.cs
- ByteStreamMessageEncoderFactory.cs
- SqlFlattener.cs
- LabelDesigner.cs
- FontUnit.cs
- GroupBox.cs
- ScrollContentPresenter.cs
- SiteIdentityPermission.cs
- FixedTextBuilder.cs
- MissingManifestResourceException.cs
- Renderer.cs
- BinHexEncoding.cs
- ClientRoleProvider.cs