探索自己实现页面基类.打造快速页面.

    在很多时候。我门需要一种页面。这种页面不需要回送。为了速度。不需要使用服务器控件。必须保持高响应。他只要做动态显示。有不能做成静态页面。比如一些vip的文章显示。投票查看了。

    webform框价功能强大。但是看看一个system.web.ui.page的源码。

None.gif
None.gif
None.gif[ToolboxItem(
false ), DesignerSerializer( " Microsoft.VisualStudio.Web.WebForms.WebFormCodeDomSerializer, Microsoft.VisualStudio.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " " System.ComponentModel.Design.Serialization.TypeCodeDomSerializer, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " ), DefaultEvent( " Load " ), Designer( " Microsoft.VisualStudio.Web.WebForms.WebFormDesigner, Microsoft.VisualStudio.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " typeof (IRootDesigner)), DesignerCategory( " ASPXCodeBehind " ), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
None.gif
public   class  Page : TemplateControl, IHttpHandler
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif      
// Events
InBlock.gif
      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public event EventHandler InitComplete;
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public event EventHandler LoadComplete;
InBlock.gif      
public event EventHandler PreInit;
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public event EventHandler PreLoad;
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public event EventHandler PreRenderComplete;
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public event EventHandler SaveStateComplete;
InBlock.gif
InBlock.gif      
// Methods
InBlock.gif
      static Page();
InBlock.gif      
public Page();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected internal void AddContentTemplate(string templateName, ITemplate template);
InBlock.gif      
public void AddOnPreRenderCompleteAsync(BeginEventHandler beginHandler, EndEventHandler endHandler);
InBlock.gif      
public void AddOnPreRenderCompleteAsync(BeginEventHandler beginHandler, EndEventHandler endHandler, object state);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected internal void AddWrappedFileDependencies(object virtualFileDependencies);
InBlock.gif      
internal void ApplyControlSkin(Control ctrl);
InBlock.gif      
internal bool ApplyControlStyleSheet(Control ctrl);
InBlock.gif      
private void ApplyMasterPage();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected IAsyncResult AspCompatBeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected void AspCompatEndProcessRequest(IAsyncResult result);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected IAsyncResult AsyncPageBeginProcessRequest(HttpContext context, AsyncCallback callback, object extraData);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected void AsyncPageEndProcessRequest(IAsyncResult result);
InBlock.gif      
private void AsyncPageProcessRequestBeforeAsyncPointCancellableCallback(object state);
InBlock.gif      
internal void BeginFormRender(HtmlTextWriter writer, string formUniqueID);
InBlock.gif      
private void BuildPageProfileTree(bool enableViewState);
InBlock.gif      
private void CheckRemainingAsyncTasks();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
protected internal virtual HtmlTextWriter CreateHtmlTextWriter(TextWriter tw);
InBlock.gif      
public static HtmlTextWriter CreateHtmlTextWriterFromType(TextWriter tw, Type writerType);
InBlock.gif      
internal static HtmlTextWriter CreateHtmlTextWriterInternal(TextWriter tw, HttpRequest request);
InBlock.gif      
internal IStateFormatter CreateStateFormatter();
InBlock.gif      
private CultureInfo CultureFromUserLanguages(bool specific);
InBlock.gif      
internal ICollection DecomposeViewStateIntoChunks();
InBlock.gif      
internal static string DecryptString(string s);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
public void DesignerInitialize();
InBlock.gif      
private bool DetermineIsExportingWebPart();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
protected internal virtual NameValueCollection DeterminePostBackMode();
InBlock.gif      
internal static string EncryptString(string s);
InBlock.gif      
internal void EndFormRender(HtmlTextWriter writer, string formUniqueID);
InBlock.gif      
public void ExecuteRegisteredAsyncTasks();
InBlock.gif      
private void ExportWebPart(string exportedWebPartID);
InBlock.gif      
public override Control FindControl(string id);
InBlock.gif      
protected override void FrameworkInitialize();
InBlock.gif      
internal NameValueCollection GetCollectionBasedOnMethod(bool dontReturnNull);
InBlock.gif      
public object GetDataItem();
InBlock.gif      
internal bool GetDesignModeInternal();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced), Obsolete(
"The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202")]
InBlock.gif      
public string GetPostBackClientEvent(Control control, string argument);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced), Obsolete(
"The recommended alternative is ClientScript.GetPostBackClientHyperlink. http://go.microsoft.com/fwlink/?linkid=14202")]
InBlock.gif      
public string GetPostBackClientHyperlink(Control control, string argument);
InBlock.gif      [Obsolete(
"The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202"), EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public string GetPostBackEventReference(Control control);
InBlock.gif      [Obsolete(
"The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202"), EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public string GetPostBackEventReference(Control control, string argument);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
public virtual int GetTypeHashCode();
InBlock.gif      
internal override string GetUniqueIDPrefix();
InBlock.gif      
public ValidatorCollection GetValidators(string validationGroup);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected object GetWrappedFileDependencies(string[] virtualFileDependencies);
InBlock.gif      
private bool HandleError(Exception e);
InBlock.gif      
protected virtual void InitializeCulture();
InBlock.gif      
internal void InitializeStyleSheet();
InBlock.gif      
private void InitializeThemes();
InBlock.gif      
private void InitializeWriter(HtmlTextWriter writer);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected internal virtual void InitOutputCache(OutputCacheParameters cacheSettings);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
protected virtual void InitOutputCache(int duration, string varyByHeader, string varyByCustom, OutputCacheLocation location, string varyByParam);
InBlock.gif      [Obsolete(
"The recommended alternative is ClientScript.IsClientScriptBlockRegistered(string key). http://go.microsoft.com/fwlink/?linkid=14202")]
InBlock.gif      
public bool IsClientScriptBlockRegistered(string key);
InBlock.gif      [Obsolete(
"The recommended alternative is ClientScript.IsStartupScriptRegistered(string key). http://go.microsoft.com/fwlink/?linkid=14202")]
InBlock.gif      
public bool IsStartupScriptRegistered(string key);
InBlock.gif      
internal static bool IsSystemPostField(string field);
InBlock.gif      
private void LoadAllState();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
protected internal virtual object LoadPageStateFromPersistenceMedium();
InBlock.gif      
internal void LoadScrollPosition();
InBlock.gif      
public string MapPath(string virtualPath);
InBlock.gif      
internal void OnFormPostRender();
InBlock.gif      
internal void OnFormRender();
InBlock.gif      
protected internal override void OnInit(EventArgs e);
InBlock.gif      
protected virtual void OnInitComplete(EventArgs e);
InBlock.gif      
protected virtual void OnLoadComplete(EventArgs e);
InBlock.gif      
protected virtual void OnPreInit(EventArgs e);
InBlock.gif      
protected virtual void OnPreLoad(EventArgs e);
InBlock.gif      
protected virtual void OnPreRenderComplete(EventArgs e);
InBlock.gif      
protected virtual void OnSaveStateComplete(EventArgs e);
InBlock.gif      
private void PerformPreInit();
InBlock.gif      
private void PerformPreRenderComplete();
InBlock.gif      
internal void PopCachingControl();
InBlock.gif      
internal void PopDataBindingContext();
InBlock.gif      
private void PrepareCallback(string callbackControlID);
InBlock.gif      
private void ProcessPostData(NameValueCollection postData, bool fBeforeLoad);
InBlock.gif      
private void ProcessRequest();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
public virtual void ProcessRequest(HttpContext context);
InBlock.gif      
private void ProcessRequest(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint);
InBlock.gif      
private void ProcessRequestCleanup();
InBlock.gif      
private void ProcessRequestEndTrace();
InBlock.gif      
private void ProcessRequestMain();
InBlock.gif      
private void ProcessRequestMain(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint);
InBlock.gif      
private void ProcessRequestTransacted();
InBlock.gif      [PermissionSet(SecurityAction.Assert, Unrestricted
=true)]
InBlock.gif      
private void ProcessRequestWithAssert(HttpContext context);
InBlock.gif      
private void ProcessRequestWithNoAssert(HttpContext context);
InBlock.gif      
internal void PushCachingControl(BasePartialCachingControl c);
InBlock.gif      
internal void PushDataBindingContext(object dataItem);
InBlock.gif      
internal void RaiseChangedEvents();
InBlock.gif      
private void RaisePostBackEvent(NameValueCollection postData);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
protected virtual void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument);
InBlock.gif      [Obsolete(
"The recommended alternative is ClientScript.RegisterArrayDeclaration(string arrayName, string arrayValue). http://go.microsoft.com/fwlink/?linkid=14202"), EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public void RegisterArrayDeclaration(string arrayName, string arrayValue);
InBlock.gif      
public void RegisterAsyncTask(PageAsyncTask task);
InBlock.gif      [Obsolete(
"The recommended alternative is ClientScript.RegisterClientScriptBlock(Type type, string key, string script). http://go.microsoft.com/fwlink/?linkid=14202"), EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public virtual void RegisterClientScriptBlock(string key, string script);
InBlock.gif      
internal void RegisterEnabledControl(Control control);
InBlock.gif      
internal void RegisterFocusScript();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced), Obsolete(
"The recommended alternative is ClientScript.RegisterHiddenField(string hiddenFieldName, string hiddenFieldInitialValue). http://go.microsoft.com/fwlink/?linkid=14202")]
InBlock.gif      
public virtual void RegisterHiddenField(string hiddenFieldName, string hiddenFieldInitialValue);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced), Obsolete(
"The recommended alternative is ClientScript.RegisterOnSubmitStatement(Type type, string key, string script). http://go.microsoft.com/fwlink/?linkid=14202")]
InBlock.gif      
public void RegisterOnSubmitStatement(string key, string script);
InBlock.gif      
internal void RegisterPostBackScript();
InBlock.gif      
internal void RegisterRequiresClearChildControlState(Control control);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public void RegisterRequiresControlState(Control control);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public void RegisterRequiresPostBack(Control control);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public virtual void RegisterRequiresRaiseEvent(IPostBackEventHandler control);
InBlock.gif      
public void RegisterRequiresViewStateEncryption();
InBlock.gif      [Obsolete(
"The recommended alternative is ClientScript.RegisterStartupScript(Type type, string key, string script). http://go.microsoft.com/fwlink/?linkid=14202"), EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public virtual void RegisterStartupScript(string key, string script);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public void RegisterViewStateHandler();
InBlock.gif      
internal void RegisterWebFormsScript();
InBlock.gif      
protected internal override void Render(HtmlTextWriter writer);
InBlock.gif      
private void RenderCallback();
InBlock.gif      
private void RenderPostBackScript(HtmlTextWriter writer, string formUniqueID);
InBlock.gif      
internal void RenderViewStateFields(HtmlTextWriter writer);
InBlock.gif      
private void RenderWebFormsScript(HtmlTextWriter writer);
InBlock.gif      
public bool RequiresControlState(Control control);
InBlock.gif      
internal void ResetOnFormRenderCalled();
InBlock.gif      
private void RestoreCultures(Thread currentThread, CultureInfo prevCulture, CultureInfo prevUICulture);
InBlock.gif      
private void SaveAllState();
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
protected internal virtual void SavePageStateToPersistenceMedium(object state);
InBlock.gif      
private void SetCulture(Thread currentThread, CultureInfo currentCulture, CultureInfo currentUICulture);
InBlock.gif      [AspNetHostingPermission(SecurityAction.LinkDemand, Level
=AspNetHostingPermissionLevel.Minimal), SecurityPermission(SecurityAction.Assert, ControlThread=true)]
InBlock.gif      
private void SetCultureWithAssert(Thread currentThread, CultureInfo currentCulture, CultureInfo currentUICulture);
InBlock.gif      
public void SetFocus(string clientID);
InBlock.gif      
public void SetFocus(Control control);
InBlock.gif      
internal void SetForm(HtmlForm form);
InBlock.gif      
internal void SetHeader(HtmlHead header);
InBlock.gif      
private void SetIntrinsics(HttpContext context);
InBlock.gif      
private void SetIntrinsics(HttpContext context, bool allowAsync);
InBlock.gif      
internal void SetPreviousPage(Page previousPage);
InBlock.gif      
internal void SetValidatorInvalidControlFocus(string clientID);
InBlock.gif      
internal bool ShouldLoadControlState(Control control);
InBlock.gif      
internal override void UnloadRecursive(bool dispose);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public void UnregisterRequiresControlState(Control control);
InBlock.gif      
public virtual void Validate();
InBlock.gif      
public virtual void Validate(string validationGroup);
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced)]
InBlock.gif      
public virtual void VerifyRenderingInServerForm(Control control);
InBlock.gif
InBlock.gif      
// Properties
InBlock.gif
      [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public HttpApplicationState Application dot.gifget; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
protected bool AspCompatMode dot.gifgetset; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
protected bool AsyncMode dot.gifgetset; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced), Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public TimeSpan AsyncTimeout dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal Control AutoPostBackControl dot.gifgetset; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool Buffer dot.gifgetset; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public Cache Cache dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal string ClientOnSubmitEvent dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string ClientQueryString dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public ClientScriptManager ClientScript dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal string ClientState dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool ClientSupportsFocus dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool ClientSupportsJavaScript dot.gifget; }
InBlock.gif      [DefaultValue(
""), EditorBrowsable(EditorBrowsableState.Advanced), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), WebSysDescription("Page_ClientTarget"), Browsable(false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string ClientTarget dot.gifgetset; }
InBlock.gif      [Browsable(
false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public int CodePage dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool ContainsCrossPagePost dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool ContainsEncryptedViewState dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool ContainsTheme dot.gifget; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false), EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string ContentType dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
protected internal override HttpContext Context dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
private StringSet ControlStateLoadedControlIds dot.gifget; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Advanced), Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string Culture dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal CultureInfo DynamicCulture dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal CultureInfo DynamicUICulture dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
private ArrayList EnabledControls dot.gifget; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never), Browsable(
false), DefaultValue(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public virtual bool EnableEventValidation dot.gifgetset; }
InBlock.gif      [Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public override bool EnableViewState dot.gifgetset; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never), Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool EnableViewStateMac dot.gifgetset; }
InBlock.gif      [WebSysDescription(
"Page_ErrorPage"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false), DefaultValue("")]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string ErrorPage dot.gifgetset; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never), Obsolete(
"The recommended alternative is HttpResponse.AddFileDependencies. http://go.microsoft.com/fwlink/?linkid=14202")]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
protected ArrayList FileDependencies dot.gifset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal Control FocusedControl dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal string FocusedControlID dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public HtmlForm Form dot.gifget; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public HtmlHead Header dot.gifget; }
InBlock.gif      [Browsable(
false), EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public override string ID dot.gifgetset; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never), Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public virtual char IdSeparator dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool IsAsync dot.gifget; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool IsCallback dot.gifget; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool IsCrossPagePostBack dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool IsExportingWebPart dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool IsExportingWebPartShared dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool IsInAspCompatMode dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool IsInOnFormRender dot.gifget; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool IsPostBack dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool IsPostBackEventControlRegistered dot.gifget; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool IsReusable dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool IsTransacted dot.gifget; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool IsValid dot.gifget; }
InBlock.gif      [Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public IDictionary Items dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal string LastFocusedControl dot.gif{ [AspNetHostingPermission(SecurityAction.Assert, Level=AspNetHostingPermissionLevel.Low)] get; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public int LCID dot.gifgetset; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool MaintainScrollPositionOnPostBack dot.gifgetset; }
InBlock.gif      [WebSysDescription(
"MasterPage_MasterPage"), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public MasterPage Master dot.gifget; }
InBlock.gif      [WebSysDescription(
"MasterPage_MasterPageFile"), DefaultValue(""), WebCategory("Behavior")]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public virtual string MasterPageFile dot.gifgetset; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public int MaxPageStateFieldLength dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public PageAdapter PageAdapter dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
protected virtual PageStatePersister PageStatePersister dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal Stack PartialCachingControlStack dot.gifget; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public Page PreviousPage dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal string RelativeFilePath dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool RenderFocusScript dot.gifget; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public HttpRequest Request dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal HttpRequest RequestInternal dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal NameValueCollection RequestValueCollection dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal string RequestViewStateString dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool RequiresViewStateEncryptionInternal dot.gifget; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public HttpResponse Response dot.gifget; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string ResponseEncoding dot.gifgetset; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public HttpServerUtility Server dot.gifget; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public virtual HttpSessionState Session dot.gifget; }
InBlock.gif      [Obsolete(
"The recommended alternative is Page.SetFocus and Page.MaintainScrollPositionOnPostBack. http://go.microsoft.com/fwlink/?linkid=14202"), Browsable(false), Filterable(false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool SmartNavigation dot.gifgetset; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false), Filterable(false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public virtual string StyleSheetTheme dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal bool SupportsStyleSheets dot.gifget; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public virtual string Theme dot.gifgetset; }
InBlock.gif      [Localizable(
true), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Bindable(true)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string Title dot.gifgetset; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public TraceContext Trace dot.gifget; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never), Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public bool TraceEnabled dot.gifgetset; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public TraceMode TraceModeValue dot.gifgetset; }
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
protected int TransactionMode dot.gifgetset; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Advanced), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string UICulture dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
protected internal virtual string UniqueFilePathSuffix dot.gifget; }
InBlock.gif      [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public IPrincipal User dot.gifget; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal string ValidatorInvalidControl dot.gifget; }
InBlock.gif      [Browsable(
false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public ValidatorCollection Validators dot.gifget; }
InBlock.gif      [Browsable(
false), EditorBrowsable(EditorBrowsableState.Never), DefaultValue(0), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public ViewStateEncryptionMode ViewStateEncryptionMode dot.gifgetset; }
InBlock.gif      [Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public string ViewStateUserKey dot.gifgetset; }
InBlock.gif      [Browsable(
false)]
ExpandedSubBlockStart.gifContractedSubBlock.gif      
public override bool Visible dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif      
internal XhtmlConformanceMode XhtmlConformanceMode dot.gifget; }
InBlock.gif
InBlock.gif      
// Fields
InBlock.gif
      internal HttpApplicationState _application;
InBlock.gif      
private bool _aspCompatMode;
InBlock.gif      
private AspCompatApplicationStep _aspCompatStep;
InBlock.gif      
private PageAsyncInfo _asyncInfo;
InBlock.gif      
private bool _asyncMode;
InBlock.gif      
private PageAsyncTaskManager _asyncTaskManager;
InBlock.gif      
private TimeSpan _asyncTimeout;
InBlock.gif      
private bool _asyncTimeoutSet;
InBlock.gif      
private Control _autoPostBackControl;
InBlock.gif      
internal Cache _cache;
InBlock.gif      
private bool _cachedRequestViewState;
InBlock.gif      
private ICallbackEventHandler _callbackControl;
InBlock.gif      
private ArrayList _changedPostDataConsumers;
InBlock.gif      
private string _clientQueryString;
InBlock.gif      
private ClientScriptManager _clientScriptManager;
InBlock.gif      
private string _clientState;
InBlock.gif      
private bool _clientSupportsJavaScript;
InBlock.gif      
private bool _clientSupportsJavaScriptChecked;
InBlock.gif      
private string _clientTarget;
InBlock.gif      
private bool _containsCrossPagePost;
InBlock.gif      
private bool _containsEncryptedViewState;
InBlock.gif      
private IDictionary _contentTemplateCollection;
InBlock.gif      
internal HttpContext _context;
InBlock.gif      
private ArrayList _controlsRequiringPostBack;
InBlock.gif      
private StringSet _controlStateLoadedControlIds;
InBlock.gif      
private Stack _dataBindingContext;
InBlock.gif      
private bool _designMode;
InBlock.gif      
private bool _designModeChecked;
InBlock.gif      
private CultureInfo _dynamicCulture;
InBlock.gif      
private CultureInfo _dynamicUICulture;
InBlock.gif      
private ArrayList _enabledControls;
InBlock.gif      
private bool _enableEventValidation;
InBlock.gif      
private bool _enableViewStateMac;
InBlock.gif      
private ViewStateEncryptionMode _encryptionMode;
InBlock.gif      
internal string _errorPage;
InBlock.gif      
private Control _focusedControl;
InBlock.gif      
private string _focusedControlID;
InBlock.gif      
private bool _fOnFormRenderCalled;
InBlock.gif      
private HtmlForm _form;
InBlock.gif      
private bool _fPageLayoutChanged;
InBlock.gif      
private bool _fPostBackScriptRendered;
InBlock.gif      
private bool _fRequirePostBackScript;
InBlock.gif      
private bool _fRequireWebFormsScript;
InBlock.gif      
private bool _fWebFormsScriptRendered;
InBlock.gif      
private bool _haveIdSeparator;
InBlock.gif      
private HtmlHead _header;
InBlock.gif      
private char _idSeparator;
InBlock.gif      
private bool _inOnFormRender;
InBlock.gif      
private bool _isCallback;
InBlock.gif      
private bool _isCrossPagePostBack;
InBlock.gif      
private IDictionary _items;
InBlock.gif      
private NameValueCollection _leftoverPostData;
InBlock.gif      
private bool _maintainScrollPosition;
InBlock.gif      
private MasterPage _master;
InBlock.gif      
private VirtualPath _masterPageFile;
InBlock.gif      
private int _maxPageStateFieldLength;
InBlock.gif      
private bool _needToPersistViewState;
InBlock.gif      
private PageAdapter _pageAdapter;
InBlock.gif      
private SimpleBitVector32 _pageFlags;
InBlock.gif      
private Stack _partialCachingControlStack;
InBlock.gif      
private PageStatePersister _persister;
InBlock.gif      
private bool _preInitWorkComplete;
InBlock.gif      
private Page _previousPage;
InBlock.gif      
private VirtualPath _previousPagePath;
InBlock.gif      
private bool _profileTreeBuilt;
InBlock.gif      
internal HybridDictionary _registeredControlsRequiringClearChildControlState;
InBlock.gif      
internal ControlSet _registeredControlsRequiringControlState;
InBlock.gif      
private ArrayList _registeredControlsThatRequirePostBack;
InBlock.gif      
private IPostBackEventHandler _registeredControlThatRequireRaiseEvent;
InBlock.gif      
private string _relativeFilePath;
InBlock.gif      
internal HttpRequest _request;
InBlock.gif      
private NameValueCollection _requestValueCollection;
InBlock.gif      
private string _requestViewState;
InBlock.gif      
private bool _requireFocusScript;
InBlock.gif      
private bool _requireScrollScript;
InBlock.gif      
internal HttpResponse _response;
InBlock.gif      
private int _scrollPositionX;
InBlock.gif      
private const string _scrollPositionXID = "__SCROLLPOSITIONX";
InBlock.gif      
private int _scrollPositionY;
InBlock.gif      
private const string _scrollPositionYID = "__SCROLLPOSITIONY";
InBlock.gif      
private HttpSessionState _session;
InBlock.gif      
private bool _sessionRetrieved;
InBlock.gif      
private SmartNavigationSupport _smartNavSupport;
InBlock.gif      
private PageTheme _styleSheet;
InBlock.gif      
private string _styleSheetName;
InBlock.gif      
private int _supportsStyleSheets;
InBlock.gif      
private PageTheme _theme;
InBlock.gif      
private string _themeName;
InBlock.gif      
private string _titleToBeSet;
InBlock.gif      
private int _transactionMode;
InBlock.gif      
private string _uniqueFilePathSuffix;
InBlock.gif      
private bool _validated;
InBlock.gif      
private string _validatorInvalidControl;
InBlock.gif      
private ValidatorCollection _validators;
InBlock.gif      
private bool _viewStateEncryptionRequested;
InBlock.gif      
private string _viewStateUserKey;
InBlock.gif      
private XhtmlConformanceMode _xhtmlConformanceMode;
InBlock.gif      
private bool _xhtmlConformanceModeSet;
InBlock.gif      
internal const bool BufferDefault = true;
InBlock.gif      
internal const string callbackID = "__CALLBACKID";
InBlock.gif      
internal const string callbackIndexID = "__CALLBACKINDEX";
InBlock.gif      
internal const string callbackLoadScriptID = "__CALLBACKLOADSCRIPT";
InBlock.gif      
internal const string callbackParameterID = "__CALLBACKPARAM";
InBlock.gif      
internal static readonly int DefaultAsyncTimeoutSeconds;
InBlock.gif      
internal static readonly int DefaultMaxPageStateFieldLength;
InBlock.gif      
private const string EnabledControlArray = "__enabledControlArray";
InBlock.gif      
internal const bool EnableEventValidationDefault = true;
InBlock.gif      
internal const bool EnableViewStateMacDefault = true;
InBlock.gif      
internal const ViewStateEncryptionMode EncryptionModeDefault = ViewStateEncryptionMode.Auto;
InBlock.gif      
internal static readonly object EventInitComplete;
InBlock.gif      
internal static readonly object EventLoadComplete;
InBlock.gif      
internal static readonly object EventPreInit;
InBlock.gif      
internal static readonly object EventPreLoad;
InBlock.gif      
internal static readonly object EventPreRenderComplete;
InBlock.gif      
internal static readonly object EventSaveStateComplete;
InBlock.gif      
internal const string EventValidationPrefixID = "__EVENTVALIDATION";
InBlock.gif      
private static readonly Version FocusMinimumEcmaVersion;
InBlock.gif      
private static readonly Version FocusMinimumJScriptVersion;
InBlock.gif      
private const int isCrossPagePostRequest = 8;
InBlock.gif      
private const int isExportingWebPart = 2;
InBlock.gif      
private const int isExportingWebPartShared = 4;
InBlock.gif      
private static readonly Version JavascriptMinimumVersion;
InBlock.gif      
private const string lastFocusID = "__LASTFOCUS";
InBlock.gif      
internal const bool MaintainScrollPositionOnPostBackDefault = false;
InBlock.gif      
private static readonly Version MSDomScrollMinimumVersion;
InBlock.gif      
private const string PageID = "__Page";
InBlock.gif      
private const string PageReEnableControlsScriptKey = "PageReEnableControlsScript";
InBlock.gif      
private const string PageRegisteredControlsThatRequirePostBackKey = "__ControlsRequirePostBackKey__";
InBlock.gif      
private const string PageScrollPositionScriptKey = "PageScrollPositionScript";
InBlock.gif      
private const string PageSubmitScriptKey = "PageSubmitScript";
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
public const string postEventArgumentID = "__EVENTARGUMENT";
InBlock.gif      [EditorBrowsable(EditorBrowsableState.Never)]
InBlock.gif      
public const string postEventSourceID = "__EVENTTARGET";
InBlock.gif      
internal const string previousPageID = "__PREVIOUSPAGE";
InBlock.gif      
private static StringSet s_systemPostFields;
InBlock.gif      
private static char[] s_varySeparator;
InBlock.gif      
internal const bool SmartNavigationDefault = false;
InBlock.gif      
private const int styleSheetInitialized = 1;
InBlock.gif      
internal const string systemPostFieldPrefix = "__";
InBlock.gif      
private static readonly string UniqueFilePathSuffixID;
InBlock.gif      
internal const string ViewStateEncryptionID = "__VIEWSTATEENCRYPTED";
InBlock.gif      
internal const string ViewStateFieldCountID = "__VIEWSTATEFIELDCOUNT";
InBlock.gif      
internal const string ViewStateFieldPrefixID = "__VIEWSTATE";
InBlock.gif      
internal const string WebPartExportID = "__WEBPARTEXPORT";
InBlock.gif
InBlock.gif      
// Nested Types
InBlock.gif
      private class PageAsyncInfo
ExpandedSubBlockStart.gifContractedSubBlock.gif      
dot.gif{
InBlock.gif            
// Methods
InBlock.gif
            internal PageAsyncInfo(Page page);
InBlock.gif            
internal void AddHandler(BeginEventHandler beginHandler, EndEventHandler endHandler, object state);
InBlock.gif            
internal void CallHandlers(bool onPageThread);
InBlock.gif            
private void CallHandlersCancellableCallback(object state);
InBlock.gif            
private void CallHandlersFromThreadpoolThread(object data);
InBlock.gif            
private void CallHandlersPossiblyUnderLock(bool onPageThread);
InBlock.gif            
private void OnAsyncHandlerCompletion(IAsyncResult ar);
InBlock.gif            
internal void SetError(Exception error);
InBlock.gif
InBlock.gif            
// Properties
ExpandedSubBlockStart.gifContractedSubBlock.gif
            internal bool AsyncPointReached dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
internal HttpAsyncResult AsyncResult dot.gifgetset; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
internal bool CallerIsBlocking dot.gifgetset; }
InBlock.gif
InBlock.gif            
// Fields
InBlock.gif
            private HttpApplication _app;
InBlock.gif            
private bool _asyncPointReached;
InBlock.gif            
private HttpAsyncResult _asyncResult;
InBlock.gif            
private ArrayList _beginHandlers;
InBlock.gif            
private bool _callerIsBlocking;
InBlock.gif            
private WaitCallback _callHandlersCancellableCallback;
InBlock.gif            
private WaitCallback _callHandlersThreadpoolCallback;
InBlock.gif            
private bool _completed;
InBlock.gif            
private AsyncCallback _completionCallback;
InBlock.gif            
private int _currentHandler;
InBlock.gif            
private ArrayList _endHandlers;
InBlock.gif            
private Exception _error;
InBlock.gif            
private int _handlerCount;
InBlock.gif            
private Page _page;
InBlock.gif            
private ArrayList _stateObjects;
InBlock.gif            
private AspNetSynchronizationContext _syncContext;
ExpandedSubBlockEnd.gif      }

ExpandedBlockEnd.gif}

None.gif 
None.gif 
None.gif



不要忘记,*.cs内的类在继承了这个page类。最后*.aspx在编译成一个类 在继承*.cs内的类。 在编译*.aspx类的时候。会分析html字符串,把所有的html标签和文字写到类内。并用服务器控件的多少来分割他。最后建立一个控件树。

  现在我门的思路是这样的 。想要用一个类来完全实现页面输出。这个类不需要继承system.web.ui.page。个人觉得在管道上切入不现实。最后选择在http处理程序上入手。所有的请求在进入http处理程序以后,检测访问路径。通过不同的路径去调用不同类的实例。不同类的内部在调用不同的模板。或者直接输出。直接产生输出结果。在http处理程序上返回。

   我的想法是把处理工厂类封装起来。但是如何让所有的页面类在第一次访问前有一个实例,我想了好久,还是想不出好的办法。于是决定把处理工厂类开放出来。这样所有的问题就全解决。我们先在逻辑层定义一个处理工厂类


 

ContractedBlock.gif ExpandedBlockStart.gif 处理工厂类 #region 处理工厂类
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 处理工厂类
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public sealed class TempletHandler : RunTimeTemplet, IHttpHandlerFactory, IRequiresSessionState
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif        
从接口继承。不需要修改这个函数#region 从接口继承。不需要修改这个函数
InBlock.gif        
public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return RunTimeTemplet.HandlerFactory(url, this);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
为实现接口写上#region 为实现接口写上
InBlock.gif        
public void ReleaseHandler(IHttpHandler handler)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
类文件和要显示页面匹配的函数。只要扩展这个函数就可以了。函数调用会自动进行#region 类文件和要显示页面匹配的函数。只要扩展这个函数就可以了。函数调用会自动进行
InBlock.gif        
protected override BaseTempletHandler AddTempletClass(string FilePath)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            BaseTempletHandler BackObject 
= null;
InBlock.gif            
switch (FilePath)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
case @"/WebSiteTest/Run/Test1.aspx"//要显示得文件可以是根本不存在得文件
InBlock.gif
                    BackObject = new CreatTempletHandler();
InBlock.gif                    
break;
InBlock.gif                
case @"/WebSiteTest/Run/Test2.aspx"//对应第二个模板aa2.htm
InBlock.gif
                    BackObject = new SecendTempletHandler();
InBlock.gif                    
break;
InBlock.gif
InBlock.gif                
case @"/WebSiteTest/Run/Test1.pdf"
InBlock.gif                    BackObject 
= new CreatTempletHandler();
InBlock.gif                    
break;
InBlock.gif                
case @"/WebSiteTest/Run/Test2.pdf"
InBlock.gif                    BackObject 
= new SecendTempletHandler();
InBlock.gif                    
break;
InBlock.gif
InBlock.gif 
InBlock.gif
InBlock.gif                
default:
InBlock.gif                    
throw new Exception("错误:" + FilePath + "没有和任何一个类文件结合");
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return BackObject;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif    
#endregion

None.gif
None.gif



    TempletHandler 类就是开放在外的处理工厂类 ,下面我门在配置文件内注册他

  <httpHandlers>
   
   <add verb="*" path="Run/*.aspx" type="BusinessTest.TempletHandler,BusinessTest"/>
   <add verb="*" path="Run/*.pdf" type="BusinessTest.TempletHandler,BusinessTest"/>
  </httpHandlers>

 表示在站点的run目录上所有的*.aspx文件和*.pdf文件全部转成我门的页面类处理。而实际上run目录上没有任何文件。


 case @"/WebSiteTest/Run/Test1.aspx":
       BackObject = new CreatTempletHandler();
这两句表示对/WebSiteTest/Run/Test1.aspx的请求 由CreatTempletHandler类处理。AddTempletClass函数一般只执行一次。在缓存没消失的情况下。他是不会被多次调用的。

CreatTempletHandler 类。他来全部负责/WebSiteTest/Run/Test1.aspx请求的输出。这种页面类只要继承BaseTempletHandler类就好了。页面布局你可以用模板来控制。显示你可以用标签来控制。当然要是想在提高速度。也可以不使用模板。并且不使用模板也绝对不会带来任何性能损失。

CreatTempletHandler,页面最终输出类的执行顺序是先是protected override void Page_Load(ref TempletReplet objILabel)函数执行。要是使用模板那在函数内部protected override void Page_Init(ref TempletReplet objILabel)函数被调用,记住Page_Init只执行一次。等Page_Load执行完毕以后 在执行其他的标签解析函数。最后 和成一个完整的页面输出。

 

ContractedBlock.gif ExpandedBlockStart.gif 第一个页面类 #region 第一个页面类
InBlock.gif    
public sealed class CreatTempletHandler : BaseTempletHandler
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Page_Load事件函数#region Page_Load事件函数
InBlock.gif        
protected override void Page_Load(ref TempletReplet objILabel)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif            
获取变量,要是不使用模板完全可以忽略#region 获取变量,要是不使用模板完全可以忽略
InBlock.gif            
if (HttpContext.Current.Request.QueryString.Count > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.PageId = HttpContext.Current.Request.QueryString[0];
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.PageId = "7";
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
this.UserId = "9";
InBlock.gif            System.Collections.Hashtable ht 
= new System.Collections.Hashtable();
InBlock.gif            ht.Add(
"PageId"this.PageId);
InBlock.gif            ht.Add(
"UserId"this.UserId);
InBlock.gif
InBlock.gif            DataSet ds 
= new DataSet();
InBlock.gif            ds.ReadXml(HttpContext.Current.Server.MapPath(
@"/WebSiteTest/templet/BadWord.xml"));
InBlock.gif
InBlock.gif            sss objss 
= new sss();
InBlock.gif            objss.SS 
= "<font Color=red>信息载体类属性一</font>";
InBlock.gif            objss.SS1 
= "<font Color=blue>信息载体类属性二.你好 我不是个稻草人</font>";
ExpandedSubBlockEnd.gif            
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif            
使用模板部分,可以不使用#region 使用模板部分,可以不使用
InBlock.gif            objILabel 
= new CreatTempletHandler();
InBlock.gif     
       objILabel.ReadFilePath = HttpContext.Current.Server.MapPath(TempletFilePath);
InBlock.gif            objILabel.Obj 
= objss;
InBlock.gif            objILabel.LabelDatatable 
= ds.Tables[0];
InBlock.gif            objILabel.LabelHashtable 
= ht;
ExpandedSubBlockEnd.gif            
#endregion

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
标签函数执行体#region 标签函数执行体
InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 无参数函数  ((sss)this.Obj) 这样使用载体类
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public string show()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return "无参数标签执行结果" + ((sss)_this.Obj).SS + "  " + ((sss)_this.Obj).SS1;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
//一个参数函数
InBlock.gif
        public string tag(string aa)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return "一个参数函数:" + aa;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
//二个参数函数
InBlock.gif
        public string tag_two(string aa, string bb)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return "二个参数函数:" + aa + " 和 " + bb;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
public string Get_Test1()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
InBlock.gif            
return "你好我开始研究" + "  " + ((sss)_this.Obj).SS1;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
标签,标签解析函数影射事件#region 标签,标签解析函数影射事件
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 标签,标签解析函数影射事件
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        protected override void Page_Init(ref TempletReplet objILabel)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//如果要使用模板。那么写这个函数。要是不用模板,那么让这个函数为空就可以
InBlock.gif
            CreatTempletHandler.AddLabel("无参书签"new Run_0(this.show), 0ref objILabel);
InBlock.gif            CreatTempletHandler.AddLabel(
"第一个书签"new Run_0(this.Get_Test1), 0ref objILabel);
InBlock.gif            CreatTempletHandler.AddLabel(
"一个参数书签"new Run_1(this.tag), 1ref objILabel);
InBlock.gif            CreatTempletHandler.AddLabel(
"二个参数书签"new Run_2(this.tag_two), 2ref objILabel); //好象这样就可以保留委托对象了 应为委托执行函数和委托是定义在一个类内
InBlock.gif
            _this = objILabel;//如果要使用载体类,那么加这个语句。否则不需要加。其实不加这个理论上也可以使用载体类的。但我没测试
ExpandedSubBlockEnd.gif
        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
public static string TempletFilePath = @"/WebSiteTest/templet/aa1.htm";//要指定的模板,当然不使用模板也完全可以
InBlock.gif
        TempletReplet _this = null;//如果要使用载体类,那么加这个语句。否则不需要加,其实不加这个理论上也可以使用载体类的。但我没测试
InBlock.gif
InBlock.gif        
//定义变量
InBlock.gif
        string PageId, UserId;
InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif    
#endregion


  这种方法页面和一般的继承page类的页面那个快,那个节省资源我没有做具体测试。其实这就是动态程序集。和内存中的对象在合并字符串速度上的比较。用页面类。可以保证在高并发情况下安全性 。就是80,90个请求同时到达,返回的结果绝对不会互相冲突。但是我没有加上多线程。应为我现在也搞不清楚在aspx页面并发很高的情况下。多线程异步回调是发生在那。处理管道上有管道池。那异步回调是发生在管道上,还是http处理程序上,或者是http处理模块上。或者是*.aspx编译成的类上。以后我加上多线程。对方法异步回调。这样我相信页面类的处理能力将更强大。

下载代码:/Files/vitality2007/Show.rar

 

 

 

 

转载于:https://www.cnblogs.com/vitality2007/archive/2006/11/01/546885.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值