Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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 // [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); // 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. // Copyright (c) Microsoft Corporation. All rights reserved.///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartConnection.cs
- PathData.cs
- X509WindowsSecurityToken.cs
- StreamGeometry.cs
- FileSystemInfo.cs
- StringPropertyBuilder.cs
- LoadedOrUnloadedOperation.cs
- PermissionToken.cs
- Win32KeyboardDevice.cs
- DummyDataSource.cs
- FontFamilyIdentifier.cs
- ForeignKeyFactory.cs
- EventHandlerList.cs
- OracleRowUpdatedEventArgs.cs
- PropertyInformation.cs
- MulticastOption.cs
- ToolStripDropDownClosingEventArgs.cs
- DocumentApplicationJournalEntry.cs
- ChannelSinkStacks.cs
- wgx_exports.cs
- TriState.cs
- SqlExpressionNullability.cs
- ToolStrip.cs
- FacetEnabledSchemaElement.cs
- ParameterInfo.cs
- QuadraticBezierSegment.cs
- RoutedCommand.cs
- PriorityBindingExpression.cs
- SymbolUsageManager.cs
- ModelFunction.cs
- MimeWriter.cs
- ValidationSummary.cs
- StrongNameIdentityPermission.cs
- SettingsAttributeDictionary.cs
- MessageQueueException.cs
- FontInfo.cs
- WebPartZoneBase.cs
- ExpressionBuilderCollection.cs
- PageMediaType.cs
- ImageList.cs
- XhtmlBasicCalendarAdapter.cs
- StreamUpgradeProvider.cs
- FilteredDataSetHelper.cs
- UiaCoreProviderApi.cs
- ResourceDescriptionAttribute.cs
- InstanceDescriptor.cs
- GlyphRunDrawing.cs
- XDeferredAxisSource.cs
- ListenerElementsCollection.cs
- ApplicationBuildProvider.cs
- KeyTimeConverter.cs
- TableRow.cs
- GetRecipientListRequest.cs
- TypeDependencyAttribute.cs
- StrokeDescriptor.cs
- FlowDocumentView.cs
- StoragePropertyMapping.cs
- RefreshPropertiesAttribute.cs
- PrintPreviewDialog.cs
- DefaultDiscoveryServiceExtension.cs
- InvokeProviderWrapper.cs
- ScrollEventArgs.cs
- MessageQueueInstaller.cs
- TypeExtensions.cs
- SmiEventSink_DeferedProcessing.cs
- DrawingAttributes.cs
- ImageMap.cs
- MetadataProperty.cs
- HScrollBar.cs
- SqlDependency.cs
- documentation.cs
- ObjectConverter.cs
- MetabaseSettings.cs
- DataGridViewColumnCollection.cs
- CodeLabeledStatement.cs
- AutomationEventArgs.cs
- DataGridViewRowCancelEventArgs.cs
- SqlDataSourceAdvancedOptionsForm.cs
- ADConnectionHelper.cs
- WinCategoryAttribute.cs
- UserThread.cs
- COAUTHIDENTITY.cs
- XmlDataDocument.cs
- MailDefinition.cs
- UserControlAutomationPeer.cs
- PlanCompiler.cs
- HtmlAnchor.cs
- Baml2006ReaderSettings.cs
- DataTableNewRowEvent.cs
- SafeFileMappingHandle.cs
- StrokeCollectionConverter.cs
- WorkflowApplicationTerminatedException.cs
- DependencyPropertyConverter.cs
- ResponseBodyWriter.cs
- ScaleTransform.cs
- NavigateEvent.cs
- PagesChangedEventArgs.cs
- ConfigurationValidatorBase.cs
- PropertyEntry.cs
- ListSourceHelper.cs