using System;
namespace WebApp3
{
using System.IO;
using System.Web;
using System.Web.UI;
using System.Collections;
using System.Collections.Specialized;
class MyPage : System.Web.UI.TemplateControl, System.Web.IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
this.SetIntrinsics(context);
this.ProcessRequest();
}
#region SetIntrinsics
private void SetIntrinsics(HttpContext context)
{
this._context = context;
this._request = context.Request;
this._response = context.Response;
this._application = context.Application;
this._cache = context.Cache;
if ((this._clientTarget != null) && (this._clientTarget.Length > 0))
{
// this._request.ClientTarget = this._clientTarget;
}
// base.HookUpAutomaticHandlers();
}
#endregion
#region ProcessRequest
private void ProcessRequest()
{
// Thread thread1 = Thread.CurrentThread;
// CultureInfo info1 = thread1.CurrentCulture;
// CultureInfo info2 = thread1.CurrentUICulture;
FrameworkInitialize();
try
{
try
{
// if (this.IsTransacted)
// {
// this.ProcessRequestTransacted();
//
// }
// else
// {
this.ProcessRequestMain();
// }
// this.ProcessRequestEndTrace();
return;
}
finally
{
// this.ProcessRequestCleanup();
// InternalSecurityPermissions.ControlThread.Assert();
// thread1.CurrentCulture = info1;
// thread1.CurrentUICulture = info2;
}
// return;
}
catch //(object obj1)
{
throw;
}
}
#endregion
private void ProcessRequestMain()
{
HttpContext context1;
// Exception exception1;
try
{
this._requestValueCollection = this.DeterminePostBackMode();
context1 = base.Context;
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "Begin Init");
// }
// base.InitRecursive(null);
InitRecursive(null);
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End Init");
// }
if (this.IsPostBack)
{
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "Begin LoadViewState");
// }
this.LoadPageViewState();
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End LoadViewState");
this.Trace.Write("aspx.page", "Begin ProcessPostData");
// }
// this.ProcessPostData(this._requestValueCollection, true);
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End ProcessPostData");
// }
}
// base.LoadRecursive();
if (this.IsPostBack)
{
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "Begin ProcessPostData Second Try");
// }
// this.ProcessPostData(this._leftoverPostData, false);
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End ProcessPostData Second Try");
this.Trace.Write("aspx.page", "Begin Raise ChangedEvents");
// }
// this.RaiseChangedEvents();
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End Raise ChangedEvents");
this.Trace.Write("aspx.page", "Begin Raise PostBackEvent");
// }
// this.RaisePostBackEvent(this._requestValueCollection);
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End Raise PostBackEvent");
// }
}
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "Begin PreRender");
// }
// base.PreRenderRecursiveInternal();
PreRenderRecursiveInternal();
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End PreRender");
base.BuildProfileTree("ROOT", base.EnableViewState);
this.Trace.Write("aspx.page", "Begin SaveViewState");
// }
this.SavePageViewState();
// if (context1.TraceIsEnabled)
// {
this.Trace.Write("aspx.page", "End SaveViewState");
this.Trace.Write("aspx.page", "Begin Render");
// }
base.RenderControl(this.CreateHtmlTextWriter(this.Response.Output));
// if (!context1.TraceIsEnabled)
// {
// return;
//
// }
// this.Trace.Write("aspx.page", "End Render");
return;
}
// catch (ThreadAbortException exception2)
// {
// base.UnloadRecursive(true);
// return;
//
// }
// catch (ConfigurationException exception3)
// {
// throw;
//
// }
catch /*(Exception exception4)*/
{
// exception1 = exception4;
// PerfCounters.IncrementCounter(AppPerfCounter.ERRORS_DURING_REQUEST);
// PerfCounters.IncrementCounter(AppPerfCounter.ERRORS_TOTAL);
// if (this.HandleError(exception1))
// {
// return;
//
// }
// throw;
// return;
}
}
internal void PreRenderRecursiveInternal()
{
// string text1;
// int num1;
// int num2;
// if (this.flags[16] == null)
// {
// this.EnsureChildControls();
// this.OnPreRender(EventArgs.Empty);
// if (this._controls != null)
// {
// text1 = this._controls.SetCollectionReadOnly("Parent_collections_readonly");
// num1 = this._controls.Count;
// for (num2 = 0; (num2 < num1); num2 += 1)
// {
// this._controls[num2].PreRenderRecursiveInternal();
//
// }
// this._controls.SetCollectionReadOnly(text1);
//
// }
//
// }
// this._controlState = ControlState.PreRendered;
}
internal void SavePageViewState()
{
if (!this._needToPersistViewState)
{
return;
}
Triplet triplet1 = new Triplet();
// int num1 = this.GetTypeHashCode();
// triplet1.First = num1.ToString(NumberFormatInfo.InvariantInfo);
// triplet1.Third = this._registeredControlsThatRequirePostBack;
// if (base.Context.TraceIsEnabled)
// {
// this.Trace.AddControlViewstateSize(base.UniqueID, LosFormatter.EstimateSize(triplet1));
//
// }
// triplet1.Second = base.SaveViewStateRecursive();
// this.SavePageStateToPersistenceMedium(triplet1);
}
protected virtual HtmlTextWriter CreateHtmlTextWriter(TextWriter tw)
{
return null; // Page.CreateHtmlTextWriterInternal(tw, this._request);
}
protected override void FrameworkInitialize()
{
this.__BuildControlTree(this);
// this.FileDependencies = ASP.TestControls_aspx.__fileDependencies;
// this.EnableViewStateMac = true;
// this.Request.ValidateInput();
}
private void __BuildControlTree(System.Web.UI.Control __ctrl)
{
this.__BuildControlform1();
// System.Web.UI.IParserAccessor __parser = ((System.Web.UI.IParserAccessor)(__ctrl));
//
// __parser.AddParsedSubObject(this.form1);
//
// __parser.AddParsedSubObject(new System.Web.UI.LiteralControl("/r/n"));
}
private System.Web.UI.Control __BuildControlform1()
{
System.Web.UI.HtmlControls.HtmlForm __ctrl;
__ctrl = new System.Web.UI.HtmlControls.HtmlForm();
this.form1 = __ctrl;
__ctrl.ID = "form1";
System.Web.UI.IParserAccessor __parser = ((System.Web.UI.IParserAccessor)(__ctrl));
__parser.AddParsedSubObject(new System.Web.UI.LiteralControl("/r/n"));
this.__BuildControlButton1();
// __parser.AddParsedSubObject(this.Button1);
__parser.AddParsedSubObject(new System.Web.UI.LiteralControl("/r/n"));
// this.__BuildControlDataGrid1();
__parser.AddParsedSubObject(this.DataGrid1);
__parser.AddParsedSubObject(new System.Web.UI.LiteralControl("/r/n"));
return __ctrl;
}
private System.Web.UI.Control __BuildControlButton1()
{
System.Web.UI.WebControls.Button __ctrl;
__ctrl = new System.Web.UI.WebControls.Button();
// this.Button1 = __ctrl;
__ctrl.ID = "Button1";
__ctrl.Text = "Button1";
// __ctrl.Click += new System.EventHandler(this.Button_Click);
return __ctrl;
}
internal void InitRecursive(Control namingContainer)
{
// string text1;
// int num1;
// int num2;
// Control control1;
// if (this._controls != null)
// {
// if (this.flags[128] != null)
// {
// namingContainer = this;
//
// }
// text1 = this._controls.SetCollectionReadOnly("Parent_collections_readonly");
// num1 = this._controls.Count;
// for (num2 = 0; (num2 < num1); num2 += 1)
// {
// control1 = this._controls[num2];
// control1._namingContainer = namingContainer;
// if (((namingContainer != null) && (control1._id == null)) && (control1.flags[64] == null))
// {
// control1.GenerateAutomaticID();
//
// }
// control1._page = this._page;
// control1.InitRecursive(namingContainer);
//
// }
// this._controls.SetCollectionReadOnly(text1);
//
// }
// if (this._controlState < ControlState.Initialized)
// {
// this._controlState = ControlState.ChildrenInitialized;
this.OnInit(EventArgs.Empty);
// this._controlState = ControlState.Initialized;
//
// }
this.TrackViewState();
}
internal void LoadPageViewState()
{
// string text1;
Triplet triplet1 =null; //= ((Triplet) this.LoadPageStateFromPersistenceMedium());
// if (triplet1 != null)
// {
// text1 = ((string) triplet1.First);
// int.Parse(text1, NumberFormatInfo.InvariantInfo);
// this._fPageLayoutChanged = (int.Parse(text1, NumberFormatInfo.InvariantInfo) != this.GetTypeHashCode());
if (!this._fPageLayoutChanged)
{
// base.LoadViewStateRecursive(triplet1.Second);
this._controlsRequiringPostBack = ((ArrayList) triplet1.Third);
}
// }
}
protected virtual NameValueCollection DeterminePostBackMode()
{
if (base.Context.Request == null)
{
return null;
}
// if (base.Context.ServerExecuteDepth > 0)
// {
// return null;
//
// }
// NameValueCollection collection1 = this.GetCollectionBasedOnMethod();
// if ((collection1["__VIEWSTATE"] == null) && (collection1["__EVENTTARGET"] == null))
// {
// collection1 = null;
//
// }
return null; // collection1;
}
public bool IsReusable
{
get
{
return false;
}
}
public TraceContext Trace
{
get
{
return base.Context.Trace;
}
}
public bool IsPostBack
{
get
{
if (this._requestValueCollection == null)
{
return false;;
}
return !this._fPageLayoutChanged;
}
}
public HttpResponse Response
{
get
{
if (this._response == null)
{
//throw new HttpException(HttpRuntime.FormatResourceString("Response_not_available"));
}
return this._response;
}
}
// Fields
internal HttpApplicationState _application;
// private bool _aspCompatMode;
// private AspCompatApplicationStep _aspCompatStep;
internal System.Web.Caching.Cache _cache;
// private ArrayList _changedPostDataConsumers;
private string _clientTarget;
internal HttpContext _context;
private ArrayList _controlsRequiringPostBack;
// private bool _enableViewStateMac;
// internal string _errorPage;
// private bool _fOnFormRenderCalled;
private System.Web.UI.HtmlControls.HtmlForm _form;
// private LosFormatter _formatter;
private bool _fPageLayoutChanged;
// private bool _fPostBackScriptRendered;
// private bool _fRequirePostBackScript;
// private bool _inOnFormRender;
// private NameValueCollection _leftoverPostData;
private bool _needToPersistViewState;
// private IDictionary _registeredArrayDeclares;
// private IDictionary _registeredClientScriptBlocks;
// private IDictionary _registeredClientStartupScripts;
// private ArrayList _registeredControlsThatRequirePostBack;
// private IPostBackEventHandler _registeredControlThatRequireRaiseEvent;
// private IDictionary _registeredHiddenFields;
// private IDictionary _registeredOnSubmitStatements;
internal HttpRequest _request;
private NameValueCollection _requestValueCollection;
internal HttpResponse _response;
// private System.Web.SessionState.HttpSessionState _session;
// private bool _sessionRetrieved;
// private SmartNavigationSupport _smartNavSupport;
// private int _transactionMode;
// private bool _validated;
// private ValidatorCollection _validators;
// private object _viewStateToPersist;
// private string _viewStateUserKey;
private const string clientScriptEnd = "// -->/r/n</script>";
private const string clientScriptStart = "<script language=/"javascript/">/r/n<!--";
private const string IncludeScriptFormat = "/r/n<script language=/"{0}/" src=/"{1}{2}/"></script>";
private const string jscriptPrefix = "javascript:";
private const string postBackFunctionName = "__doPostBack";
protected const string postEventArgumentID = "__EVENTARGUMENT";
protected const string postEventSourceID = "__EVENTTARGET";
// private static IDictionary s_systemPostFields;
// private static char[] s_varySeparator;
private const string systemPostFieldPrefix = "__";
internal const string viewStateID = "__VIEWSTATE";
protected System.Web.UI.HtmlControls.HtmlForm form1;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
// private System.Web.UI.DataBoundLiteralControl __control5;
// private System.Web.UI.WebControls.TemplateColumn __control3;
// private System.Web.UI.WebControls.DataGridColumnCollection __control2;
}
}