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
- WebPartConnectionsConnectVerb.cs
- UrlAuthFailedErrorFormatter.cs
- InternalUserCancelledException.cs
- InputLangChangeEvent.cs
- Message.cs
- DrawingBrush.cs
- ImageCreator.cs
- NameNode.cs
- XmlTextEncoder.cs
- Oid.cs
- Atom10FormatterFactory.cs
- WmlFormAdapter.cs
- LogicalTreeHelper.cs
- HttpsTransportBindingElement.cs
- SQLInt32Storage.cs
- SQLBinaryStorage.cs
- TrackingMemoryStreamFactory.cs
- LeftCellWrapper.cs
- AndCondition.cs
- ContractSearchPattern.cs
- SHA1CryptoServiceProvider.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- PrintPageEvent.cs
- XmlUrlResolver.cs
- ShapingWorkspace.cs
- RewritingPass.cs
- ControlAdapter.cs
- SqlException.cs
- OneOfTypeConst.cs
- DesignerDataTable.cs
- TraceSource.cs
- GridViewCommandEventArgs.cs
- RequestCachePolicyConverter.cs
- ConsumerConnectionPointCollection.cs
- StrokeNodeEnumerator.cs
- XmlBinaryWriterSession.cs
- glyphs.cs
- BufferedGraphics.cs
- XmlDataDocument.cs
- QilXmlReader.cs
- HybridDictionary.cs
- OpenTypeLayout.cs
- ListenerElementsCollection.cs
- CalendarTable.cs
- EntityDataSourceDesignerHelper.cs
- ReadonlyMessageFilter.cs
- ConfigDefinitionUpdates.cs
- RootContext.cs
- CodeArrayIndexerExpression.cs
- IPEndPoint.cs
- ExceptionRoutedEventArgs.cs
- LinkLabel.cs
- COM2PropertyDescriptor.cs
- HoistedLocals.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- PersonalizationProviderCollection.cs
- CAGDesigner.cs
- TdsParserHelperClasses.cs
- PersonalizationEntry.cs
- EnterpriseServicesHelper.cs
- NameObjectCollectionBase.cs
- TraceSwitch.cs
- InputElement.cs
- ResourcesChangeInfo.cs
- UserNameSecurityTokenProvider.cs
- SimpleHandlerFactory.cs
- CodePageEncoding.cs
- StsCommunicationException.cs
- NeutralResourcesLanguageAttribute.cs
- StackOverflowException.cs
- CodeMethodReturnStatement.cs
- RepeaterItem.cs
- MbpInfo.cs
- CodeVariableDeclarationStatement.cs
- SafeRegistryKey.cs
- HttpWebResponse.cs
- DatagridviewDisplayedBandsData.cs
- SQLInt64.cs
- XamlTreeBuilder.cs
- Console.cs
- ButtonChrome.cs
- ToolStripAdornerWindowService.cs
- SqlComparer.cs
- PrintingPermission.cs
- AmbientEnvironment.cs
- BlobPersonalizationState.cs
- ImageAnimator.cs
- LoadMessageLogger.cs
- DocumentPageViewAutomationPeer.cs
- _FixedSizeReader.cs
- NetworkStream.cs
- SqlCaseSimplifier.cs
- XsltContext.cs
- MTConfigUtil.cs
- DataServiceExpressionVisitor.cs
- NullExtension.cs
- DataGridViewCellLinkedList.cs
- Handle.cs
- StorageRoot.cs
- MenuEventArgs.cs