2 // System.Web.UI.Page.cs
5 // Duncan Mak (duncan@ximian.com)
6 // Gonzalo Paniagua (gonzalo@ximian.com)
7 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
9 // (C) 2002,2003 Ximian, Inc. (http://www.ximian.com)
10 // Copyright (C) 2003,2005 Novell, Inc (http://www.novell.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.Collections;
34 using System.Collections.Specialized;
35 using System.ComponentModel;
36 using System.ComponentModel.Design;
37 using System.ComponentModel.Design.Serialization;
38 using System.Globalization;
40 using System.Security.Cryptography;
41 using System.Security.Permissions;
42 using System.Security.Principal;
44 using System.Threading;
46 using System.Web.Caching;
47 using System.Web.Configuration;
48 using System.Web.SessionState;
49 using System.Web.Util;
50 using System.Web.UI.HtmlControls;
51 using System.Web.UI.WebControls;
53 using System.Web.UI.Adapters;
54 using System.Collections.Generic;
55 using System.Reflection;
58 namespace System.Web.UI
61 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
62 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
64 [RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
66 [DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
69 [Designer ("Microsoft.VisualStudio.Web.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VisualStudio_Web, typeof (IRootDesigner))]
71 [Designer ("Microsoft.VSDesigner.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VSDesigner, typeof (IRootDesigner))]
73 public partial class Page : TemplateControl, IHttpHandler
75 static string machineKeyConfigPath = "system.web/machineKey";
77 private PageLifeCycle _lifeCycle = PageLifeCycle.Unknown;
78 private bool _eventValidation = true;
79 private object [] _savedControlState;
80 private bool _doLoadPreviousPage;
81 string _focusedControlID;
82 bool _hasEnabledControlArray;
84 private bool _viewState = true;
85 private bool _viewStateMac;
86 private string _errorPage;
87 private bool is_validated;
88 private bool _smartNavigation;
89 private int _transactionMode;
90 private ValidatorCollection _validators;
91 private bool renderingForm;
92 private string _savedViewState;
93 private ArrayList _requiresPostBack;
94 private ArrayList _requiresPostBackCopy;
95 private ArrayList requiresPostDataChanged;
96 private IPostBackEventHandler requiresRaiseEvent;
97 private NameValueCollection secondPostData;
98 private bool requiresPostBackScript;
99 private bool postBackScriptRendered;
100 bool handleViewState;
101 string viewStateUserKey;
102 NameValueCollection _requestValueCollection;
104 ClientScriptManager scriptManager;
105 bool allow_load; // true when the Form collection belongs to this page (GetTypeHashCode)
106 PageStatePersister page_state_persister;
107 CultureInfo _appCulture;
108 CultureInfo _appUICulture;
110 // The initial context
111 private HttpContext _context;
113 // cached from the initial context
114 HttpApplicationState _application;
115 HttpResponse _response;
116 HttpRequest _request;
119 HttpSessionState _session;
121 [EditorBrowsable (EditorBrowsableState.Never)]
127 const string postEventArgumentID = "__EVENTARGUMENT";
129 [EditorBrowsable (EditorBrowsableState.Never)]
135 const string postEventSourceID = "__EVENTTARGET";
138 const string ScrollPositionXID = "__SCROLLPOSITIONX";
139 const string ScrollPositionYID = "__SCROLLPOSITIONY";
140 const string EnabledControlArrayID = "__enabledControlArray";
144 internal const string LastFocusID = "__LASTFOCUS";
145 internal const string CallbackArgumentID = "__CALLBACKARGUMENT";
146 internal const string CallbackSourceID = "__CALLBACKTARGET";
147 internal const string PreviousPageID = "__PREVIOUSPAGE";
151 MasterPage masterPage;
152 string masterPageFile;
155 bool isCrossPagePostBack;
158 ArrayList requireStateControls;
163 string _styleSheetTheme;
166 bool _maintainScrollPositionOnPostBack;
168 private bool asyncMode = false;
169 private TimeSpan asyncTimeout;
170 private const double DefaultAsyncTimeout = 45.0;
171 private List<PageAsyncTask> parallelTasks;
172 private List<PageAsyncTask> serialTasks;
174 private ViewStateEncryptionMode viewStateEncryptionMode;
175 private bool controlRegisteredForViewStateEncryption = false;
181 scriptManager = new ClientScriptManager (this);
186 PagesSection ps = WebConfigurationManager.GetSection ("system.web/pages") as PagesSection;
188 asyncTimeout = ps.AsyncTimeout;
189 viewStateEncryptionMode = ps.ViewStateEncryptionMode;
191 asyncTimeout = TimeSpan.FromSeconds (DefaultAsyncTimeout);
192 viewStateEncryptionMode = ViewStateEncryptionMode.Auto;
201 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
203 public HttpApplicationState Application {
204 get { return _application; }
207 [EditorBrowsable (EditorBrowsableState.Never)]
208 protected bool AspCompatMode {
210 get { return false; }
212 set { throw new NotImplementedException (); }
215 [EditorBrowsable (EditorBrowsableState.Never)]
217 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
218 [BrowsableAttribute (false)]
220 get { return Response.BufferOutput; }
221 set { Response.BufferOutput = value; }
224 protected bool Buffer {
225 set { Response.BufferOutput = value; }
229 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
234 throw new HttpException ("Cache is not available.");
240 [EditorBrowsableAttribute (EditorBrowsableState.Advanced)]
242 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
243 [Browsable (false), DefaultValue ("")]
244 [WebSysDescription ("Value do override the automatic browser detection and force the page to use the specified browser.")]
245 public string ClientTarget {
246 get { return (clientTarget == null) ? "" : clientTarget; }
248 clientTarget = value;
254 [EditorBrowsable (EditorBrowsableState.Never)]
256 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
257 [BrowsableAttribute (false)]
258 public int CodePage {
259 get { return Response.ContentEncoding.CodePage; }
260 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
263 protected int CodePage {
264 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
268 [EditorBrowsable (EditorBrowsableState.Never)]
270 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
271 [BrowsableAttribute (false)]
272 public string ContentType {
273 get { return Response.ContentType; }
274 set { Response.ContentType = value; }
277 protected string ContentType {
278 set { Response.ContentType = value; }
282 protected override HttpContext Context {
284 if (_context == null)
285 return HttpContext.Current;
292 [EditorBrowsable (EditorBrowsableState.Advanced)]
293 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
294 [BrowsableAttribute (false)]
295 public string Culture {
296 get { return Thread.CurrentThread.CurrentCulture.Name; }
297 set { Thread.CurrentThread.CurrentCulture = GetPageCulture (value, Thread.CurrentThread.CurrentCulture); }
300 [EditorBrowsable (EditorBrowsableState.Never)]
301 protected string Culture {
302 set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
307 public virtual bool EnableEventValidation {
308 get { return _eventValidation; }
310 if (_lifeCycle > PageLifeCycle.Init)
311 throw new InvalidOperationException ("The 'EnableEventValidation' property can be set only in the Page_init, the Page directive or in the <pages> configuration section.");
312 _eventValidation = value;
316 internal PageLifeCycle LifeCycle {
317 get { return _lifeCycle; }
322 public override bool EnableViewState {
323 get { return _viewState; }
324 set { _viewState = value; }
328 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
329 [BrowsableAttribute (false)]
331 [EditorBrowsable (EditorBrowsableState.Never)]
337 bool EnableViewStateMac {
338 get { return _viewStateMac; }
339 set { _viewStateMac = value; }
343 internal bool EnableViewStateMacInternal {
344 get { return _viewStateMac; }
345 set { _viewStateMac = value; }
349 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
350 [Browsable (false), DefaultValue ("")]
351 [WebSysDescription ("The URL of a page used for error redirection.")]
352 public string ErrorPage {
353 get { return _errorPage; }
355 HttpContext ctx = Context;
359 ctx.ErrorPage = value;
366 [EditorBrowsable (EditorBrowsableState.Never)]
367 protected ArrayList FileDependencies {
369 if (Response != null)
370 Response.AddFileDependencies (value);
376 [EditorBrowsable (EditorBrowsableState.Never)]
378 public override string ID {
379 get { return base.ID; }
380 set { base.ID = value; }
383 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
385 public bool IsPostBack {
390 return _requestValueCollection != null;
395 [EditorBrowsable (EditorBrowsableState.Never), Browsable (false)]
396 public bool IsReusable {
397 get { return false; }
400 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
402 public bool IsValid {
405 throw new HttpException (Locale.GetText ("Page hasn't been validated."));
408 foreach (IValidator val in Validators)
413 return ValidateCollection (_validators);
418 public IDictionary Items {
421 items = new Hashtable ();
427 [EditorBrowsable (EditorBrowsableState.Never)]
429 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
430 [BrowsableAttribute (false)]
432 get { return Thread.CurrentThread.CurrentCulture.LCID; }
433 set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
437 set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
443 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
444 public bool MaintainScrollPositionOnPostBack {
445 get { return _maintainScrollPositionOnPostBack; }
446 set { _maintainScrollPositionOnPostBack = value; }
451 public PageAdapter PageAdapter {
453 return (PageAdapter)Adapter;
459 internal string theForm {
465 internal bool IsMultiForm {
466 get { return false; }
470 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
472 public HttpRequest Request {
474 if (_request == null)
475 throw new HttpException("Request is not available in this context.");
480 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
482 public HttpResponse Response {
484 if (_response == null)
485 throw new HttpException ("Response is not available in this context.");
490 [EditorBrowsable (EditorBrowsableState.Never)]
492 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
493 [BrowsableAttribute (false)]
494 public string ResponseEncoding {
495 get { return Response.ContentEncoding.WebName; }
496 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
499 protected string ResponseEncoding {
500 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
504 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
506 public HttpServerUtility Server {
507 get { return Context.Server; }
510 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
512 public virtual HttpSessionState Session {
514 if (_session != null)
518 _session = Context.Session;
520 // ignore, should not throw
523 if (_session == null)
524 throw new HttpException ("Session state can only be used " +
525 "when enableSessionState is set to true, either " +
526 "in a configuration file or in the Page directive.");
533 [FilterableAttribute (false)]
537 public bool SmartNavigation {
538 get { return _smartNavigation; }
539 set { _smartNavigation = value; }
543 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
546 public virtual string StyleSheetTheme {
547 get { return _styleSheetTheme; }
548 set { _styleSheetTheme = value; }
552 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
553 public virtual string Theme {
554 get { return _theme; }
555 set { _theme = value; }
558 void InitializeStyleSheet ()
560 if (_styleSheetTheme == null) {
561 PagesSection ps = WebConfigurationManager.GetSection ("system.web/pages") as PagesSection;
563 _styleSheetTheme = ps.StyleSheetTheme;
565 if (_styleSheetTheme != null && _styleSheetTheme != "")
566 _styleSheetPageTheme = ThemeDirectoryCompiler.GetCompiledInstance (_styleSheetTheme, Context);
569 void InitializeTheme ()
571 if (_theme == null) {
572 PagesSection ps = WebConfigurationManager.GetSection ("system.web/pages") as PagesSection;
576 if (_theme != null && _theme != "") {
577 _pageTheme = ThemeDirectoryCompiler.GetCompiledInstance (_theme, Context);
578 _pageTheme.SetPage (this);
587 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
588 public string Title {
590 if (_title == null) {
591 if (htmlHeader != null)
592 return htmlHeader.Title;
598 if (htmlHeader != null)
599 htmlHeader.Title = value;
606 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
608 public TraceContext Trace {
609 get { return Context.Trace; }
612 [EditorBrowsable (EditorBrowsableState.Never)]
614 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
615 [BrowsableAttribute (false)]
616 public bool TraceEnabled {
617 get { return Trace.IsEnabled; }
618 set { Trace.IsEnabled = value; }
621 protected bool TraceEnabled {
622 set { Trace.IsEnabled = value; }
626 [EditorBrowsable (EditorBrowsableState.Never)]
628 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
629 [BrowsableAttribute (false)]
630 public TraceMode TraceModeValue {
631 get { return Trace.TraceMode; }
632 set { Trace.TraceMode = value; }
635 protected TraceMode TraceModeValue {
636 set { Trace.TraceMode = value; }
640 [EditorBrowsable (EditorBrowsableState.Never)]
641 protected int TransactionMode {
643 get { return _transactionMode; }
645 set { _transactionMode = value; }
650 // This method is here just to remove the warning about "_transactionMode" not being
651 // used. We probably will use it internally at some point.
653 internal int GetTransactionMode ()
655 return _transactionMode;
660 [EditorBrowsable (EditorBrowsableState.Advanced)]
661 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
662 [BrowsableAttribute (false)]
663 public string UICulture {
664 get { return Thread.CurrentThread.CurrentUICulture.Name; }
665 set { Thread.CurrentThread.CurrentUICulture = GetPageCulture (value, Thread.CurrentThread.CurrentUICulture); }
668 [EditorBrowsable (EditorBrowsableState.Never)]
669 protected string UICulture {
670 set { Thread.CurrentThread.CurrentUICulture = new CultureInfo (value); }
674 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
676 public IPrincipal User {
677 get { return Context.User; }
680 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
682 public ValidatorCollection Validators {
684 if (_validators == null)
685 _validators = new ValidatorCollection ();
690 [MonoTODO ("Use this when encrypting/decrypting ViewState")]
692 public string ViewStateUserKey {
693 get { return viewStateUserKey; }
694 set { viewStateUserKey = value; }
698 public override bool Visible {
699 get { return base.Visible; }
700 set { base.Visible = value; }
708 CultureInfo GetPageCulture (string culture, CultureInfo deflt)
712 CultureInfo ret = null;
713 if (culture.StartsWith ("auto", StringComparison.InvariantCultureIgnoreCase)) {
715 //if (Context.IsPortletRequest)
718 string[] languages = Request.UserLanguages;
720 if (languages != null && languages.Length > 0)
721 ret = CultureInfo.CreateSpecificCulture (languages[0]);
728 ret = CultureInfo.CreateSpecificCulture (culture);
734 [EditorBrowsable (EditorBrowsableState.Never)]
735 protected IAsyncResult AspCompatBeginProcessRequest (HttpContext context,
739 throw new NotImplementedException ();
742 [EditorBrowsable (EditorBrowsableState.Never)]
743 protected void AspCompatEndProcessRequest (IAsyncResult result)
745 throw new NotImplementedException ();
748 [EditorBrowsable (EditorBrowsableState.Advanced)]
749 protected virtual HtmlTextWriter CreateHtmlTextWriter (TextWriter tw)
751 return new HtmlTextWriter (tw);
754 [EditorBrowsable (EditorBrowsableState.Never)]
755 public void DesignerInitialize ()
757 InitRecursive (null);
760 [EditorBrowsable (EditorBrowsableState.Advanced)]
761 protected virtual NameValueCollection DeterminePostBackMode ()
763 if (_context.IsProcessingInclude)
766 HttpRequest req = Request;
770 NameValueCollection coll = null;
771 if (0 == String.Compare (Request.HttpMethod, "POST", true, CultureInfo.InvariantCulture))
774 coll = req.QueryString;
776 WebROCollection c = (WebROCollection) coll;
777 allow_load = !c.GotID;
779 c.ID = GetTypeHashCode ();
781 allow_load = (c.ID == GetTypeHashCode ());
783 if (coll != null && coll ["__VIEWSTATE"] == null && coll ["__EVENTTARGET"] == null)
786 if (getFacesContext () != null && _context.Handler != _context.CurrentHandler) {
787 // check if it is PreviousPage
788 string prevViewId = coll [PreviousPageID];
789 if (!String.IsNullOrEmpty (prevViewId)) {
790 string appPath = VirtualPathUtility.RemoveTrailingSlash (Request.ApplicationPath);
791 prevViewId = prevViewId.Substring (appPath.Length);
792 isCrossPagePostBack = String.Compare (prevViewId, getFacesContext ().getExternalContext ().getRequestPathInfo (), StringComparison.OrdinalIgnoreCase) == 0;
800 public override Control FindControl (string id) {
801 return FindControl (id, false);
804 private Control FindControl (string id, bool decode) {
807 id = DecodeNamespace (id);
812 return base.FindControl (id);
819 [EditorBrowsable (EditorBrowsableState.Advanced)]
820 public string GetPostBackClientEvent (Control control, string argument)
822 return scriptManager.GetPostBackEventReference (control, argument);
828 [EditorBrowsable (EditorBrowsableState.Advanced)]
829 public string GetPostBackClientHyperlink (Control control, string argument)
831 return scriptManager.GetPostBackClientHyperlink (control, argument);
837 [EditorBrowsable (EditorBrowsableState.Advanced)]
838 public string GetPostBackEventReference (Control control)
840 return scriptManager.GetPostBackEventReference (control, "");
846 [EditorBrowsable (EditorBrowsableState.Advanced)]
847 public string GetPostBackEventReference (Control control, string argument)
849 return scriptManager.GetPostBackEventReference (control, argument);
852 internal void RequiresPostBackScript ()
855 if (requiresPostBackScript)
857 ClientScript.RegisterHiddenField (postEventSourceID, String.Empty);
858 ClientScript.RegisterHiddenField (postEventArgumentID, String.Empty);
860 requiresPostBackScript = true;
863 [EditorBrowsable (EditorBrowsableState.Never)]
864 public virtual int GetTypeHashCode ()
870 [MonoTODO("The following properties of OutputCacheParameters are silently ignored: CacheProfile, NoStore, SqlDependency")]
871 protected internal virtual void InitOutputCache(OutputCacheParameters cacheSettings)
873 if (cacheSettings.Enabled)
874 InitOutputCache(cacheSettings.Duration,
875 cacheSettings.VaryByHeader,
876 cacheSettings.VaryByCustom,
877 cacheSettings.Location,
878 cacheSettings.VaryByParam);
882 [EditorBrowsable (EditorBrowsableState.Never)]
883 protected virtual void InitOutputCache (int duration,
886 OutputCacheLocation location,
889 HttpCachePolicy cache = Response.Cache;
890 bool set_vary = false;
891 HttpContext ctx = Context;
892 DateTime timestamp = ctx != null ? ctx.Timestamp : DateTime.Now;
895 case OutputCacheLocation.Any:
896 cache.SetCacheability (HttpCacheability.Public);
897 cache.SetMaxAge (new TimeSpan (0, 0, duration));
898 cache.SetLastModified (timestamp);
901 case OutputCacheLocation.Client:
902 cache.SetCacheability (HttpCacheability.Private);
903 cache.SetMaxAge (new TimeSpan (0, 0, duration));
904 cache.SetLastModified (timestamp);
906 case OutputCacheLocation.Downstream:
907 cache.SetCacheability (HttpCacheability.Public);
908 cache.SetMaxAge (new TimeSpan (0, 0, duration));
909 cache.SetLastModified (timestamp);
911 case OutputCacheLocation.Server:
912 cache.SetCacheability (HttpCacheability.Server);
915 case OutputCacheLocation.None:
920 if (varyByCustom != null)
921 cache.SetVaryByCustom (varyByCustom);
923 if (varyByParam != null && varyByParam.Length > 0) {
924 string[] prms = varyByParam.Split (';');
925 foreach (string p in prms)
926 cache.VaryByParams [p.Trim ()] = true;
927 cache.VaryByParams.IgnoreParams = false;
929 cache.VaryByParams.IgnoreParams = true;
932 if (varyByHeader != null && varyByHeader.Length > 0) {
933 string[] hdrs = varyByHeader.Split (';');
934 foreach (string h in hdrs)
935 cache.VaryByHeaders [h.Trim ()] = true;
939 cache.Duration = duration;
940 cache.SetExpires (timestamp.AddSeconds (duration));
946 [EditorBrowsable (EditorBrowsableState.Advanced)]
948 public bool IsClientScriptBlockRegistered (string key)
950 return scriptManager.IsClientScriptBlockRegistered (key);
956 [EditorBrowsable (EditorBrowsableState.Advanced)]
958 public bool IsStartupScriptRegistered (string key)
960 return scriptManager.IsStartupScriptRegistered (key);
963 public string MapPath (string virtualPath)
965 return Request.MapPath (virtualPath);
969 protected internal override void Render (HtmlTextWriter writer) {
970 if (MaintainScrollPositionOnPostBack) {
971 ClientScript.RegisterWebFormClientScript ();
973 ClientScript.RegisterHiddenField (ScrollPositionXID, Request [ScrollPositionXID]);
974 ClientScript.RegisterHiddenField (ScrollPositionYID, Request [ScrollPositionYID]);
976 string webForm = IsMultiForm ? theForm + "." : null;
978 StringBuilder script = new StringBuilder ();
979 script.AppendLine ("<script type=\"text/javascript\">");
980 script.AppendLine (ClientScriptManager.SCRIPT_BLOCK_START);
981 script.AppendLine (theForm + ".oldSubmit = " + theForm + ".submit;");
982 script.AppendLine (theForm + ".submit = function () { " + webForm + "WebForm_SaveScrollPositionSubmit(); }");
983 script.AppendLine (theForm + ".oldOnSubmit = " + theForm + ".onsubmit;");
984 script.AppendLine (theForm + ".onsubmit = function () { " + webForm + "WebForm_SaveScrollPositionOnSubmit(); }");
986 script.AppendLine (theForm + ".oldOnLoad = window.onload;");
987 script.AppendLine ("window.onload = function () { " + webForm + "WebForm_RestoreScrollPosition (); };");
989 script.AppendLine (ClientScriptManager.SCRIPT_BLOCK_END);
990 script.AppendLine ("</script>");
992 ClientScript.RegisterStartupScript (typeof (Page), "MaintainScrollPositionOnPostBackStartup", script.ToString());
994 base.Render (writer);
998 private void RenderPostBackScript (HtmlTextWriter writer, string formUniqueID)
1001 writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventSourceID);
1002 writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventArgumentID);
1004 writer.WriteLine ();
1006 ClientScriptManager.WriteBeginScriptBlock (writer);
1009 RenderClientScriptFormDeclaration (writer, formUniqueID);
1012 writer.WriteLine ("{0}._form = {0};", theForm);
1013 writer.Write (theForm + ".");
1015 writer.WriteLine ("window._form = {0};", theForm);
1017 writer.WriteLine ("__doPostBack = function (eventTarget, eventArgument) {");
1019 writer.WriteLine ("\tif(this._form.onsubmit && this._form.onsubmit() == false) return;");
1021 writer.WriteLine ("\tif(document.ValidatorOnSubmit && !ValidatorOnSubmit()) return;");
1023 writer.WriteLine ("\tthis._form.{0}.value = eventTarget;", postEventSourceID);
1024 writer.WriteLine ("\tthis._form.{0}.value = eventArgument;", postEventArgumentID);
1025 writer.WriteLine ("\tthis._form.submit();");
1026 writer.WriteLine ("}");
1027 ClientScriptManager.WriteEndScriptBlock (writer);
1030 void RenderClientScriptFormDeclaration (HtmlTextWriter writer, string formUniqueID)
1032 writer.WriteLine ("\tvar {0};\n\tif (document.getElementById) {{ {0} = document.getElementById ('{1}'); }}", theForm, formUniqueID);
1033 writer.WriteLine ("\telse {{ {0} = document.{1}; }}", theForm, formUniqueID);
1034 writer.WriteLine ("\t{0}._instanceVariableName = '{0}';", theForm);
1036 string serverUrl = EncodeURL (Request.RawUrl);
1037 writer.WriteLine ("\t{0}.serverURL = {1};", theForm, ClientScriptManager.GetScriptLiteral (serverUrl));
1038 writer.WriteLine ("\twindow.TARGET_J2EE = true;");
1039 writer.WriteLine ("\twindow.IsMultiForm = {0};", IsMultiForm ? "true" : "false");
1043 internal void OnFormRender (HtmlTextWriter writer, string formUniqueID)
1046 throw new HttpException ("Only 1 HtmlForm is allowed per page.");
1048 renderingForm = true;
1049 writer.WriteLine ();
1052 ClientScriptManager.WriteBeginScriptBlock (writer);
1053 RenderClientScriptFormDeclaration (writer, formUniqueID);
1054 ClientScriptManager.WriteEndScriptBlock (writer);
1057 if (handleViewState)
1059 if (getFacesContext () != null) {
1060 javax.faces.application.ViewHandler viewHandler = getFacesContext ().getApplication ().getViewHandler ();
1061 javax.faces.context.ResponseWriter oldFacesWriter = SetupResponseWriter (writer);
1063 viewHandler.writeState (getFacesContext ());
1066 getFacesContext ().setResponseWriter (oldFacesWriter);
1070 scriptManager.RegisterHiddenField ("__VIEWSTATE", _savedViewState);
1072 scriptManager.WriteHiddenFields (writer);
1073 if (requiresPostBackScript) {
1074 RenderPostBackScript (writer, formUniqueID);
1075 postBackScriptRendered = true;
1078 scriptManager.WriteWebFormClientScript (writer);
1080 scriptManager.WriteClientScriptBlocks (writer);
1083 internal IStateFormatter GetFormatter ()
1085 return new ObjectStateFormatter (this);
1088 internal string GetSavedViewState ()
1090 return _savedViewState;
1093 internal void OnFormPostRender (HtmlTextWriter writer, string formUniqueID)
1096 scriptManager.SaveEventValidationState ();
1097 scriptManager.WriteExpandoAttributes (writer);
1099 scriptManager.WriteHiddenFields (writer);
1100 if (!postBackScriptRendered && requiresPostBackScript)
1101 RenderPostBackScript (writer, formUniqueID);
1103 scriptManager.WriteWebFormClientScript (writer);
1106 scriptManager.WriteArrayDeclares (writer);
1107 scriptManager.WriteStartupScriptBlocks (writer);
1108 renderingForm = false;
1109 postBackScriptRendered = false;
1112 private void ProcessPostData (NameValueCollection data, bool second)
1114 NameValueCollection requestValues = _requestValueCollection == null ?
1115 new NameValueCollection () :
1116 _requestValueCollection;
1118 if (data != null && data.Count > 0) {
1119 Hashtable used = new Hashtable ();
1120 foreach (string id in data.AllKeys){
1121 if (id == "__VIEWSTATE" || id == postEventSourceID || id == postEventArgumentID ||
1122 id == ClientScriptManager.EventStateFieldName)
1125 if (used.ContainsKey (id))
1130 Control ctrl = FindControl (id, true);
1132 IPostBackDataHandler pbdh = ctrl as IPostBackDataHandler;
1133 IPostBackEventHandler pbeh = ctrl as IPostBackEventHandler;
1137 RegisterRequiresRaiseEvent (pbeh);
1141 if (pbdh.LoadPostData (id, requestValues) == true) {
1142 if (requiresPostDataChanged == null)
1143 requiresPostDataChanged = new ArrayList ();
1144 requiresPostDataChanged.Add (pbdh);
1147 if (_requiresPostBackCopy != null)
1148 _requiresPostBackCopy.Remove (id);
1150 } else if (!second) {
1151 if (secondPostData == null)
1152 secondPostData = new NameValueCollection ();
1153 secondPostData.Add (id, data [id]);
1158 ArrayList list1 = null;
1159 if (_requiresPostBackCopy != null && _requiresPostBackCopy.Count > 0) {
1160 string [] handlers = (string []) _requiresPostBackCopy.ToArray (typeof (string));
1161 foreach (string id in handlers) {
1162 IPostBackDataHandler pbdh = FindControl (id, true) as IPostBackDataHandler;
1164 _requiresPostBackCopy.Remove (id);
1165 if (pbdh.LoadPostData (id, requestValues)) {
1166 if (requiresPostDataChanged == null)
1167 requiresPostDataChanged = new ArrayList ();
1169 requiresPostDataChanged.Add (pbdh);
1171 } else if (!second) {
1173 list1 = new ArrayList ();
1178 _requiresPostBackCopy = second ? null : list1;
1180 secondPostData = null;
1183 [EditorBrowsable (EditorBrowsableState.Never)]
1185 public virtual void ProcessRequest (HttpContext context)
1187 public void ProcessRequest (HttpContext context)
1191 _lifeCycle = PageLifeCycle.Unknown;
1193 SetContext (context);
1195 if (clientTarget != null)
1196 Request.ClientTarget = clientTarget;
1198 WireupAutomaticEvents ();
1199 //-- Control execution lifecycle in the docs
1201 // Save culture information because it can be modified in FrameworkInitialize()
1202 _appCulture = Thread.CurrentThread.CurrentCulture;
1203 _appUICulture = Thread.CurrentThread.CurrentUICulture;
1204 FrameworkInitialize ();
1205 context.ErrorPage = _errorPage;
1208 InternalProcessRequest ();
1211 catch (Exception ex) {
1212 HandleException (ex);
1216 catch (ThreadAbortException) {
1217 // Do nothing, just ignore it by now.
1218 } catch (Exception e) {
1219 ProcessException (e);
1228 void ProcessException (Exception ex) {
1229 _context.AddError (ex); // OnError might access LastError
1230 OnError (EventArgs.Empty);
1231 _context.ClearError (ex);
1232 // We want to remove that error, as we're rethrowing to stop
1233 // further processing.
1234 Trace.Warn ("Unhandled Exception", ex.ToString (), ex);
1237 void ProcessUnload () {
1240 _lifeCycle = PageLifeCycle.Unload;
1243 UnloadRecursive (true);
1245 _lifeCycle = PageLifeCycle.End;
1249 if (getFacesContext () != null) {
1250 if(IsCrossPagePostBack)
1251 _context.Items [CrossPagePostBack] = this;
1254 if (Thread.CurrentThread.CurrentCulture.Equals (_appCulture) == false)
1255 Thread.CurrentThread.CurrentCulture = _appCulture;
1257 if (Thread.CurrentThread.CurrentUICulture.Equals (_appUICulture) == false)
1258 Thread.CurrentThread.CurrentUICulture = _appUICulture;
1261 _appUICulture = null;
1265 delegate void ProcessRequestDelegate (HttpContext context);
1267 private sealed class DummyAsyncResult : IAsyncResult
1269 readonly object state;
1270 readonly WaitHandle asyncWaitHandle;
1271 readonly bool completedSynchronously;
1272 readonly bool isCompleted;
1274 public DummyAsyncResult (bool isCompleted, bool completedSynchronously, object state)
1276 this.isCompleted = isCompleted;
1277 this.completedSynchronously = completedSynchronously;
1280 asyncWaitHandle = new ManualResetEvent (true);
1283 asyncWaitHandle = new ManualResetEvent (false);
1287 #region IAsyncResult Members
1289 public object AsyncState {
1290 get { return state; }
1293 public WaitHandle AsyncWaitHandle {
1294 get { return asyncWaitHandle; }
1297 public bool CompletedSynchronously {
1298 get { return completedSynchronously; }
1301 public bool IsCompleted {
1302 get { return isCompleted; }
1308 protected IAsyncResult AsyncPageBeginProcessRequest (HttpContext context, AsyncCallback callback, object extraData)
1310 ProcessRequest (context);
1311 DummyAsyncResult asyncResult = new DummyAsyncResult (true, true, extraData);
1313 if (callback != null) {
1314 callback (asyncResult);
1320 protected void AsyncPageEndProcessRequest (IAsyncResult result)
1325 void InternalProcessRequest ()
1327 _requestValueCollection = this.DeterminePostBackMode();
1331 // http://msdn2.microsoft.com/en-us/library/ms178141.aspx
1332 if (_requestValueCollection != null) {
1333 if (!isCrossPagePostBack && _requestValueCollection [PreviousPageID] != null && _requestValueCollection [PreviousPageID] != Request.FilePath) {
1334 _doLoadPreviousPage = true;
1337 isCallback = _requestValueCollection [CallbackArgumentID] != null;
1338 // LAMESPEC: on Callback IsPostBack is set to false, but true.
1339 //isPostBack = !isCallback;
1342 string lastFocus = _requestValueCollection [LastFocusID];
1343 if (!String.IsNullOrEmpty (lastFocus)) {
1344 _focusedControlID = UniqueID2ClientID (lastFocus);
1348 if (!isCrossPagePostBack) {
1349 if (_context.PreviousHandler is Page) {
1350 previousPage = (Page) _context.PreviousHandler;
1354 _lifeCycle = PageLifeCycle.PreInit;
1355 Trace.Write ("aspx.page", "Begin PreInit");
1356 OnPreInit (EventArgs.Empty);
1357 Trace.Write ("aspx.page", "End PreInit");
1361 _lifeCycle = PageLifeCycle.Init;
1363 Trace.Write ("aspx.page", "Begin Init");
1364 InitRecursive (null);
1365 Trace.Write ("aspx.page", "End Init");
1368 _lifeCycle = PageLifeCycle.InitComplete;
1369 Trace.Write ("aspx.page", "Begin InitComplete");
1370 OnInitComplete (EventArgs.Empty);
1371 Trace.Write ("aspx.page", "End InitComplete");
1374 renderingForm = false;
1377 if (getFacesContext () != null)
1378 if (IsPostBack || IsCallback)
1382 RestorePageState ();
1384 ProcessRaiseChangedEvents ();
1385 ProcessRaisePostBackEvents ();
1386 if (ProcessLoadComplete ())
1389 if (getFacesContext () != null)
1395 void RestorePageState () {
1397 if (IsPostBack || IsCallback) {
1402 _lifeCycle = PageLifeCycle.PreLoad;
1403 if (_requestValueCollection != null)
1404 scriptManager.RestoreEventValidationState (
1405 _requestValueCollection [ClientScriptManager.EventStateFieldName]);
1407 Trace.Write ("aspx.page", "Begin LoadViewState");
1408 LoadPageViewState ();
1409 Trace.Write ("aspx.page", "End LoadViewState");
1413 void ProcessPostData () {
1419 if (IsPostBack || IsCallback) {
1423 Trace.Write ("aspx.page", "Begin ProcessPostData");
1424 ProcessPostData (_requestValueCollection, false);
1425 Trace.Write ("aspx.page", "End ProcessPostData");
1433 // RestoreValidatorsState ();
1436 if (IsPostBack || IsCallback) {
1441 _lifeCycle = PageLifeCycle.ControlEvents;
1443 Trace.Write ("aspx.page", "Begin ProcessPostData Second Try");
1444 ProcessPostData (secondPostData, true);
1445 Trace.Write ("aspx.page", "End ProcessPostData Second Try");
1449 void ProcessLoad () {
1451 Trace.Write ("aspx.page", "Begin PreLoad");
1452 OnPreLoad (EventArgs.Empty);
1453 Trace.Write ("aspx.page", "End PreLoad");
1454 _lifeCycle = PageLifeCycle.Load;
1457 Trace.Write ("aspx.page", "Begin Load");
1459 Trace.Write ("aspx.page", "End Load");
1462 void ProcessRaiseChangedEvents () {
1468 if (IsPostBack || IsCallback) {
1472 Trace.Write ("aspx.page", "Begin Raise ChangedEvents");
1473 RaiseChangedEvents ();
1474 Trace.Write ("aspx.page", "End Raise ChangedEvents");
1478 void ProcessRaisePostBackEvents () {
1484 if (IsPostBack || IsCallback) {
1488 Trace.Write ("aspx.page", "Begin Raise PostBackEvent");
1489 RaisePostBackEvents ();
1490 Trace.Write ("aspx.page", "End Raise PostBackEvent");
1494 bool ProcessLoadComplete() {
1497 _lifeCycle = PageLifeCycle.LoadComplete;
1498 Trace.Write ("aspx.page", "Begin LoadComplete");
1499 OnLoadComplete (EventArgs.Empty);
1500 Trace.Write ("aspx.page", "End LoadComplete");
1502 if (IsCrossPagePostBack)
1507 if (getFacesContext () != null) {
1508 _callbackTarget = GetCallbackTarget ();
1509 ProcessRaiseCallbackEvent (_callbackTarget, ref _callbackEventError);
1513 string result = ProcessCallbackData ();
1514 HtmlTextWriter callbackOutput = new HtmlTextWriter (Response.Output);
1515 callbackOutput.Write (result);
1516 callbackOutput.Flush ();
1520 _lifeCycle = PageLifeCycle.PreRender;
1523 Trace.Write ("aspx.page", "Begin PreRender");
1524 PreRenderRecursiveInternal ();
1525 Trace.Write ("aspx.page", "End PreRender");
1528 ExecuteRegisteredAsyncTasks ();
1530 _lifeCycle = PageLifeCycle.PreRenderComplete;
1531 Trace.Write ("aspx.page", "Begin PreRenderComplete");
1532 OnPreRenderComplete (EventArgs.Empty);
1533 Trace.Write ("aspx.page", "End PreRenderComplete");
1536 Trace.Write ("aspx.page", "Begin SaveViewState");
1537 SavePageViewState ();
1538 Trace.Write ("aspx.page", "End SaveViewState");
1541 _lifeCycle = PageLifeCycle.SaveStateComplete;
1542 Trace.Write ("aspx.page", "Begin SaveStateComplete");
1543 OnSaveStateComplete (EventArgs.Empty);
1544 Trace.Write ("aspx.page", "End SaveStateComplete");
1549 internal void RenderPage () {
1551 _lifeCycle = PageLifeCycle.Render;
1552 scriptManager.ResetEventValidationState ();
1556 Trace.Write ("aspx.page", "Begin Render");
1557 HtmlTextWriter output = new HtmlTextWriter (Response.Output);
1559 if (getFacesContext () != null)
1560 SetupResponseWriter (output);
1562 RenderControl (output);
1563 Trace.Write ("aspx.page", "End Render");
1566 void SetContext (HttpContext context) {
1569 _application = context.Application;
1570 _response = context.Response;
1571 _request = context.Request;
1572 _cache = context.Cache;
1575 private void RenderTrace ()
1577 TraceManager traceManager = HttpRuntime.TraceManager;
1579 if (Trace.HaveTrace && !Trace.IsEnabled || !Trace.HaveTrace && !traceManager.Enabled)
1584 if (!Trace.HaveTrace && traceManager.Enabled && !traceManager.PageOutput)
1587 if (!traceManager.LocalOnly || Context.Request.IsLocal) {
1588 HtmlTextWriter output = new HtmlTextWriter (Response.Output);
1589 Trace.Render (output);
1594 bool CheckForValidationSupport (Control targetControl)
1596 if (targetControl == null)
1598 Type type = targetControl.GetType ();
1599 object[] attributes = type.GetCustomAttributes (false);
1600 foreach (object attr in attributes)
1601 if (attr is SupportsEventValidationAttribute)
1607 void RaisePostBackEvents ()
1610 Control targetControl;
1612 if (requiresRaiseEvent != null) {
1613 RaisePostBackEvent (requiresRaiseEvent, null);
1617 NameValueCollection postdata = _requestValueCollection;
1618 if (postdata == null)
1621 string eventTarget = postdata [postEventSourceID];
1622 if (eventTarget == null || eventTarget.Length == 0) {
1628 targetControl = FindControl (eventTarget, true);
1629 IPostBackEventHandler target = targetControl as IPostBackEventHandler;
1631 IPostBackEventHandler target = FindControl (eventTarget) as IPostBackEventHandler;
1637 string eventArgument = postdata [postEventArgumentID];
1638 RaisePostBackEvent (target, eventArgument);
1641 internal void RaiseChangedEvents ()
1643 if (requiresPostDataChanged == null)
1646 foreach (IPostBackDataHandler ipdh in requiresPostDataChanged)
1647 ipdh.RaisePostDataChangedEvent ();
1649 requiresPostDataChanged = null;
1652 [EditorBrowsable (EditorBrowsableState.Advanced)]
1653 protected virtual void RaisePostBackEvent (IPostBackEventHandler sourceControl, string eventArgument)
1656 Control targetControl = sourceControl as Control;
1657 if (targetControl != null && CheckForValidationSupport (targetControl))
1658 scriptManager.ValidateEvent (targetControl.UniqueID, eventArgument);
1660 sourceControl.RaisePostBackEvent (eventArgument);
1666 [EditorBrowsable (EditorBrowsableState.Advanced)]
1667 public void RegisterArrayDeclaration (string arrayName, string arrayValue)
1669 scriptManager.RegisterArrayDeclaration (arrayName, arrayValue);
1675 [EditorBrowsable (EditorBrowsableState.Advanced)]
1676 public virtual void RegisterClientScriptBlock (string key, string script)
1678 scriptManager.RegisterClientScriptBlock (key, script);
1684 [EditorBrowsable (EditorBrowsableState.Advanced)]
1685 public virtual void RegisterHiddenField (string hiddenFieldName, string hiddenFieldInitialValue)
1687 scriptManager.RegisterHiddenField (hiddenFieldName, hiddenFieldInitialValue);
1690 [MonoTODO("Not implemented, Used in HtmlForm")]
1691 internal void RegisterClientScriptFile (string a, string b, string c)
1693 throw new NotImplementedException ();
1699 [EditorBrowsable (EditorBrowsableState.Advanced)]
1700 public void RegisterOnSubmitStatement (string key, string script)
1702 scriptManager.RegisterOnSubmitStatement (key, script);
1705 internal string GetSubmitStatements ()
1707 return scriptManager.WriteSubmitStatements ();
1710 [EditorBrowsable (EditorBrowsableState.Advanced)]
1711 public void RegisterRequiresPostBack (Control control)
1714 if (!(control is IPostBackDataHandler))
1715 throw new HttpException ("The control to register does not implement the IPostBackDataHandler interface.");
1718 if (_requiresPostBack == null)
1719 _requiresPostBack = new ArrayList ();
1721 if (_requiresPostBack.Contains (control.UniqueID))
1724 _requiresPostBack.Add (control.UniqueID);
1727 [EditorBrowsable (EditorBrowsableState.Advanced)]
1728 public virtual void RegisterRequiresRaiseEvent (IPostBackEventHandler control)
1730 requiresRaiseEvent = control;
1736 [EditorBrowsable (EditorBrowsableState.Advanced)]
1737 public virtual void RegisterStartupScript (string key, string script)
1739 scriptManager.RegisterStartupScript (key, script);
1742 [EditorBrowsable (EditorBrowsableState.Advanced)]
1743 public void RegisterViewStateHandler ()
1745 handleViewState = true;
1748 [EditorBrowsable (EditorBrowsableState.Advanced)]
1749 protected virtual void SavePageStateToPersistenceMedium (object viewState)
1751 PageStatePersister persister = this.PageStatePersister;
1752 if (persister == null)
1754 Pair pair = viewState as Pair;
1756 persister.ViewState = pair.First;
1757 persister.ControlState = pair.Second;
1759 persister.ViewState = viewState;
1763 internal string RawViewState {
1765 NameValueCollection postdata = _requestValueCollection;
1767 if (postdata == null || (view_state = postdata ["__VIEWSTATE"]) == null)
1770 if (view_state == "")
1774 set { _savedViewState = value; }
1782 PageStatePersister PageStatePersister {
1784 if (page_state_persister == null)
1786 if (getFacesContext () != null)
1787 return new FacesPageStatePersister (this);
1790 page_state_persister = new HiddenFieldPageStatePersister (this);
1791 return page_state_persister;
1795 [EditorBrowsable (EditorBrowsableState.Advanced)]
1796 protected virtual object LoadPageStateFromPersistenceMedium ()
1798 PageStatePersister persister = this.PageStatePersister;
1799 if (persister == null)
1802 return new Pair (persister.ViewState, persister.ControlState);
1805 internal void LoadPageViewState()
1807 Pair sState = LoadPageStateFromPersistenceMedium () as Pair;
1808 if (sState != null) {
1811 LoadPageControlState (sState.Second);
1813 Pair vsr = sState.First as Pair;
1815 LoadViewStateRecursive (vsr.First);
1816 _requiresPostBackCopy = vsr.Second as ArrayList;
1822 internal void SavePageViewState ()
1824 if (!handleViewState)
1828 object controlState = SavePageControlState ();
1831 object viewState = SaveViewStateRecursive ();
1832 object reqPostback = (_requiresPostBack != null && _requiresPostBack.Count > 0) ? _requiresPostBack : null;
1835 if (viewState != null || reqPostback != null)
1836 vsr = new Pair (viewState, reqPostback);
1837 Pair pair = new Pair ();
1841 pair.Second = controlState;
1845 if (pair.First == null && pair.Second == null)
1846 SavePageStateToPersistenceMedium (null);
1848 SavePageStateToPersistenceMedium (pair);
1852 public virtual void Validate ()
1854 is_validated = true;
1855 ValidateCollection (_validators);
1859 internal bool AreValidatorsUplevel () {
1860 return AreValidatorsUplevel (String.Empty);
1863 internal bool AreValidatorsUplevel (string valGroup)
1865 internal virtual bool AreValidatorsUplevel ()
1868 bool uplevel = false;
1870 foreach (IValidator v in Validators) {
1871 BaseValidator bv = v as BaseValidator;
1872 if (bv == null) continue;
1875 if (valGroup != bv.ValidationGroup)
1878 if (bv.GetRenderUplevel()) {
1887 bool ValidateCollection (ValidatorCollection validators)
1890 if (!_eventValidation)
1894 if (validators == null || validators.Count == 0)
1897 bool all_valid = true;
1898 foreach (IValidator v in validators){
1900 if (v.IsValid == false)
1907 [EditorBrowsable (EditorBrowsableState.Advanced)]
1908 public virtual void VerifyRenderingInServerForm (Control control)
1910 if (Context == null)
1917 throw new HttpException ("Control '" +
1920 control.GetType ().Name +
1921 "' must be placed inside a form tag with runat=server.");
1924 protected override void FrameworkInitialize ()
1926 base.FrameworkInitialize ();
1928 InitializeStyleSheet ();
1939 ClientScriptManager ClientScript {
1940 get { return scriptManager; }
1945 static readonly object InitCompleteEvent = new object ();
1946 static readonly object LoadCompleteEvent = new object ();
1947 static readonly object PreInitEvent = new object ();
1948 static readonly object PreLoadEvent = new object ();
1949 static readonly object PreRenderCompleteEvent = new object ();
1950 static readonly object SaveStateCompleteEvent = new object ();
1952 const int initcomplete_mask = 1;
1953 const int loadcomplete_mask = 1 << 1;
1954 const int preinit_mask = 1 << 2;
1955 const int preload_mask = 1 << 3;
1956 const int prerendercomplete_mask = 1 << 4;
1957 const int savestatecomplete_mask = 1 << 5;
1959 [EditorBrowsable (EditorBrowsableState.Advanced)]
1960 public event EventHandler InitComplete {
1962 event_mask |= initcomplete_mask;
1963 Events.AddHandler (InitCompleteEvent, value);
1965 remove { Events.RemoveHandler (InitCompleteEvent, value); }
1968 [EditorBrowsable (EditorBrowsableState.Advanced)]
1969 public event EventHandler LoadComplete {
1971 event_mask |= loadcomplete_mask;
1972 Events.AddHandler (LoadCompleteEvent, value);
1974 remove { Events.RemoveHandler (LoadCompleteEvent, value); }
1977 public event EventHandler PreInit {
1979 event_mask |= preinit_mask;
1980 Events.AddHandler (PreInitEvent, value);
1982 remove { Events.RemoveHandler (PreInitEvent, value); }
1985 [EditorBrowsable (EditorBrowsableState.Advanced)]
1986 public event EventHandler PreLoad {
1988 event_mask |= preload_mask;
1989 Events.AddHandler (PreLoadEvent, value);
1991 remove { Events.RemoveHandler (PreLoadEvent, value); }
1994 [EditorBrowsable (EditorBrowsableState.Advanced)]
1995 public event EventHandler PreRenderComplete {
1997 event_mask |= prerendercomplete_mask;
1998 Events.AddHandler (PreRenderCompleteEvent, value);
2000 remove { Events.RemoveHandler (PreRenderCompleteEvent, value); }
2003 [EditorBrowsable (EditorBrowsableState.Advanced)]
2004 public event EventHandler SaveStateComplete {
2006 event_mask |= savestatecomplete_mask;
2007 Events.AddHandler (SaveStateCompleteEvent, value);
2009 remove { Events.RemoveHandler (SaveStateCompleteEvent, value); }
2012 protected virtual void OnInitComplete (EventArgs e)
2014 if ((event_mask & initcomplete_mask) != 0) {
2015 EventHandler eh = (EventHandler) (Events [InitCompleteEvent]);
2016 if (eh != null) eh (this, e);
2020 protected virtual void OnLoadComplete (EventArgs e)
2022 if ((event_mask & loadcomplete_mask) != 0) {
2023 EventHandler eh = (EventHandler) (Events [LoadCompleteEvent]);
2024 if (eh != null) eh (this, e);
2028 protected virtual void OnPreInit (EventArgs e)
2030 if ((event_mask & preinit_mask) != 0) {
2031 EventHandler eh = (EventHandler) (Events [PreInitEvent]);
2032 if (eh != null) eh (this, e);
2036 protected virtual void OnPreLoad (EventArgs e)
2038 if ((event_mask & preload_mask) != 0) {
2039 EventHandler eh = (EventHandler) (Events [PreLoadEvent]);
2040 if (eh != null) eh (this, e);
2044 protected virtual void OnPreRenderComplete (EventArgs e)
2046 if ((event_mask & prerendercomplete_mask) != 0) {
2047 EventHandler eh = (EventHandler) (Events [PreRenderCompleteEvent]);
2048 if (eh != null) eh (this, e);
2053 if (!Form.DetermineRenderUplevel ())
2056 string defaultButtonId = Form.DefaultButton;
2057 /* figure out if we have some control we're going to focus */
2058 if (String.IsNullOrEmpty (_focusedControlID)) {
2059 _focusedControlID = Form.DefaultFocus;
2060 if (String.IsNullOrEmpty (_focusedControlID))
2061 _focusedControlID = defaultButtonId;
2064 if (!String.IsNullOrEmpty (_focusedControlID)) {
2065 ClientScript.RegisterWebFormClientScript ();
2066 ClientScript.RegisterStartupScript (
2067 "HtmlForm-DefaultButton-StartupScript",
2069 "<script type=\"text/javascript\">\n{0}\nWebForm_AutoFocus('{1}');\n{2}\n</script>\n",
2070 ClientScriptManager.SCRIPT_BLOCK_START,
2072 ClientScriptManager.SCRIPT_BLOCK_END)
2076 if (Form.SubmitDisabledControls && _hasEnabledControlArray) {
2077 ClientScript.RegisterWebFormClientScript ();
2078 ClientScript.RegisterOnSubmitStatement ("HtmlForm-SubmitDisabledControls-SubmitStatement",
2079 "WebForm_ReEnableControls(this);");
2083 internal void RegisterEnabledControl (Control control)
2085 if (Form == null || !Page.Form.SubmitDisabledControls || !Page.Form.DetermineRenderUplevel ())
2087 _hasEnabledControlArray = true;
2088 Page.ClientScript.RegisterArrayDeclaration (EnabledControlArrayID, String.Format ("'{0}'", control.ClientID));
2091 protected virtual void OnSaveStateComplete (EventArgs e)
2093 if ((event_mask & savestatecomplete_mask) != 0) {
2094 EventHandler eh = (EventHandler) (Events [SaveStateCompleteEvent]);
2095 if (eh != null) eh (this, e);
2099 public HtmlForm Form {
2100 get { return _form; }
2103 internal void RegisterForm (HtmlForm form)
2108 [BrowsableAttribute (false)]
2109 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
2110 public Page PreviousPage {
2112 if (_doLoadPreviousPage) {
2113 _doLoadPreviousPage = false;
2114 LoadPreviousPageReference ();
2116 return previousPage;
2121 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
2122 [BrowsableAttribute (false)]
2123 public bool IsCallback {
2124 get { return isCallback; }
2127 [BrowsableAttribute (false)]
2128 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
2129 public bool IsCrossPagePostBack {
2130 get { return isCrossPagePostBack; }
2133 public new virtual char IdSeparator {
2135 //TODO: why override?
2136 return base.IdSeparator;
2140 string ProcessCallbackData ()
2142 ICallbackEventHandler target = GetCallbackTarget ();
2143 string callbackEventError = String.Empty;
2144 ProcessRaiseCallbackEvent (target, ref callbackEventError);
2145 return ProcessGetCallbackResult (target, callbackEventError);
2148 ICallbackEventHandler GetCallbackTarget () {
2149 string callbackTarget = _requestValueCollection [CallbackSourceID];
2150 if (callbackTarget == null || callbackTarget.Length == 0)
2151 throw new HttpException ("Callback target not provided.");
2153 Control targetControl = FindControl (callbackTarget, true);
2154 ICallbackEventHandler target = targetControl as ICallbackEventHandler;
2156 throw new HttpException (string.Format ("Invalid callback target '{0}'.", callbackTarget));
2160 void ProcessRaiseCallbackEvent (ICallbackEventHandler target, ref string callbackEventError) {
2161 string callbackArgument = _requestValueCollection [CallbackArgumentID];
2164 target.RaiseCallbackEvent (callbackArgument);
2166 catch (Exception ex) {
2167 callbackEventError = String.Format ("e{0}", ex.Message);
2171 string ProcessGetCallbackResult (ICallbackEventHandler target, string callbackEventError) {
2172 string callBackResult;
2174 callBackResult = target.GetCallbackResult ();
2176 catch (Exception ex) {
2177 return String.Format ("e{0}", ex.Message);
2180 string eventValidation = ClientScript.GetEventValidationStateFormatted ();
2181 return String.Format ("{0}{1}|{2}{3}", callbackEventError, eventValidation == null ? 0 : eventValidation.Length, eventValidation, callBackResult);
2184 [BrowsableAttribute (false)]
2185 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
2186 public HtmlHead Header {
2187 get { return htmlHeader; }
2190 internal void SetHeader (HtmlHead header)
2192 htmlHeader = header;
2193 if (_title != null) {
2194 htmlHeader.Title = _title;
2199 protected bool AsyncMode {
2200 get { return asyncMode; }
2201 set { asyncMode = value; }
2204 public TimeSpan AsyncTimeout {
2205 get { return asyncTimeout; }
2206 set { asyncTimeout = value; }
2209 public bool IsAsync {
2210 get { return AsyncMode; }
2213 [MonoTODO ("Not Implemented")]
2214 protected internal virtual string UniqueFilePathSuffix {
2216 throw new NotImplementedException ();
2220 [MonoTODO ("Not Implemented")]
2221 public int MaxPageStateFieldLength {
2223 throw new NotImplementedException ();
2226 throw new NotImplementedException ();
2230 public void AddOnPreRenderCompleteAsync (BeginEventHandler beginHandler, EndEventHandler endHandler)
2232 AddOnPreRenderCompleteAsync (beginHandler, endHandler, null);
2235 public void AddOnPreRenderCompleteAsync (BeginEventHandler beginHandler, EndEventHandler endHandler, Object state)
2238 throw new InvalidOperationException ("AddOnPreRenderCompleteAsync called and Page.IsAsync == false");
2241 if (_lifeCycle >= PageLifeCycle.PreRender) {
2242 throw new InvalidOperationException ("AddOnPreRenderCompleteAsync can only be called before PreRender.");
2245 if (beginHandler == null) {
2246 throw new ArgumentNullException ("beginHandler");
2249 if (endHandler == null) {
2250 throw new ArgumentNullException ("endHandler");
2253 RegisterAsyncTask (new PageAsyncTask (beginHandler, endHandler, null, state, false));
2256 private List<PageAsyncTask> ParallelTasks {
2258 if (parallelTasks == null) {
2259 parallelTasks = new List<PageAsyncTask>();
2261 return parallelTasks;
2265 private List<PageAsyncTask> SerialTasks {
2267 if (serialTasks == null) {
2268 serialTasks = new List<PageAsyncTask> ();
2274 public void RegisterAsyncTask (PageAsyncTask task)
2277 throw new ArgumentNullException ("task");
2280 if (task.ExecuteInParallel) {
2281 ParallelTasks.Add (task);
2284 SerialTasks.Add (task);
2288 public void ExecuteRegisteredAsyncTasks ()
2290 if ((parallelTasks == null || parallelTasks.Count == 0) &&
2291 (serialTasks == null || serialTasks.Count == 0)){
2295 if (parallelTasks != null) {
2296 DateTime startExecution = DateTime.Now;
2297 List<PageAsyncTask> localParallelTasks = parallelTasks;
2298 parallelTasks = null; // Shouldn't execute tasks twice
2299 List<IAsyncResult> asyncResults = new List<IAsyncResult>();
2300 foreach (PageAsyncTask parallelTask in localParallelTasks) {
2301 IAsyncResult result = parallelTask.BeginHandler (this, EventArgs.Empty, new AsyncCallback (EndAsyncTaskCallback), parallelTask.State);
2302 if (result.CompletedSynchronously) {
2303 parallelTask.EndHandler (result);
2306 asyncResults.Add (result);
2310 if (asyncResults.Count > 0) {
2312 TimeSpan timeout = AsyncTimeout;
2313 long t1 = DateTime.Now.Ticks;
2314 bool signalled = true;
2315 for (int i = 0; i < asyncResults.Count; i++) {
2316 if (asyncResults [i].IsCompleted)
2320 signalled = asyncResults [i].AsyncWaitHandle.WaitOne (timeout, false);
2323 long t2 = DateTime.Now.Ticks;
2324 timeout = AsyncTimeout - TimeSpan.FromTicks (t2 - t1);
2325 if (timeout.Ticks <= 0)
2329 localParallelTasks [i].TimeoutHandler (asyncResults [i]);
2333 WaitHandle [] waitArray = new WaitHandle [asyncResults.Count];
2335 for (i = 0; i < asyncResults.Count; i++) {
2336 waitArray [i] = asyncResults [i].AsyncWaitHandle;
2338 bool allSignalled = WaitHandle.WaitAll (waitArray, AsyncTimeout, false);
2339 if (!allSignalled) {
2340 for (i = 0; i < asyncResults.Count; i++) {
2341 if (!asyncResults [i].IsCompleted) {
2342 localParallelTasks [i].TimeoutHandler (asyncResults [i]);
2348 DateTime endWait = DateTime.Now;
2349 TimeSpan elapsed = endWait - startExecution;
2350 if (elapsed <= AsyncTimeout) {
2351 AsyncTimeout -= elapsed;
2354 AsyncTimeout = TimeSpan.FromTicks(0);
2358 if (serialTasks != null) {
2359 List<PageAsyncTask> localSerialTasks = serialTasks;
2360 serialTasks = null; // Shouldn't execute tasks twice
2361 foreach (PageAsyncTask serialTask in localSerialTasks) {
2362 DateTime startExecution = DateTime.Now;
2364 IAsyncResult result = serialTask.BeginHandler (this, EventArgs.Empty, new AsyncCallback (EndAsyncTaskCallback), serialTask);
2365 if (result.CompletedSynchronously) {
2366 serialTask.EndHandler (result);
2369 bool done = result.AsyncWaitHandle.WaitOne (AsyncTimeout, false);
2370 if (!done && !result.IsCompleted) {
2371 serialTask.TimeoutHandler (result);
2374 DateTime endWait = DateTime.Now;
2375 TimeSpan elapsed = endWait - startExecution;
2376 if (elapsed <= AsyncTimeout) {
2377 AsyncTimeout -= elapsed;
2380 AsyncTimeout = TimeSpan.FromTicks (0);
2384 AsyncTimeout = TimeSpan.FromSeconds (DefaultAsyncTimeout);
2387 void EndAsyncTaskCallback (IAsyncResult result)
2389 PageAsyncTask task = (PageAsyncTask)result.AsyncState;
2390 task.EndHandler (result);
2393 public static HtmlTextWriter CreateHtmlTextWriterFromType (TextWriter tw, Type writerType)
2395 Type htmlTextWriterType = typeof (HtmlTextWriter);
2397 if (!htmlTextWriterType.IsAssignableFrom (writerType)) {
2398 throw new HttpException (String.Format ("Type '{0}' cannot be assigned to HtmlTextWriter", writerType.FullName));
2401 ConstructorInfo constructor = writerType.GetConstructor (new Type [] { typeof (TextWriter) });
2402 if (constructor == null) {
2403 throw new HttpException (String.Format ("Type '{0}' does not have a consturctor that takes a TextWriter as parameter", writerType.FullName));
2406 return (HtmlTextWriter) Activator.CreateInstance(writerType, tw);
2409 public ViewStateEncryptionMode ViewStateEncryptionMode {
2410 get { return viewStateEncryptionMode; }
2411 set { viewStateEncryptionMode = value; }
2414 public void RegisterRequiresViewStateEncryption ()
2416 controlRegisteredForViewStateEncryption = true;
2419 private static byte [] AES_IV = null;
2420 private static byte [] TripleDES_IV = null;
2421 private static object locker = new object ();
2422 private static bool isEncryptionInitialized = false;
2424 private static void InitializeEncryption ()
2426 if (isEncryptionInitialized) {
2431 if (isEncryptionInitialized) {
2435 string iv_string = "0BA48A9E-736D-40f8-954B-B2F62241F282";
2436 AES_IV = new byte [16];
2437 TripleDES_IV = new byte [8];
2440 for (i = 0; i < AES_IV.Length; i++) {
2441 AES_IV [i] = (byte) iv_string [i];
2444 for (i = 0; i < TripleDES_IV.Length; i++) {
2445 TripleDES_IV [i] = (byte) iv_string [i];
2448 isEncryptionInitialized = true;
2452 internal ICryptoTransform GetCryptoTransform (CryptoStreamMode cryptoStreamMode)
2454 ICryptoTransform transform = null;
2455 MachineKeySection config = (MachineKeySection) WebConfigurationManager.GetSection (machineKeyConfigPath);
2456 byte [] vk = MachineKeySectionUtils.ValidationKeyBytes (config);
2458 switch (config.Validation) {
2459 case MachineKeyValidation.SHA1:
2460 transform = SHA1.Create ();
2463 case MachineKeyValidation.MD5:
2464 transform = MD5.Create ();
2467 case MachineKeyValidation.AES:
2468 if (cryptoStreamMode == CryptoStreamMode.Read){
2469 transform = Rijndael.Create().CreateDecryptor(vk, AES_IV);
2471 transform = Rijndael.Create().CreateEncryptor(vk, AES_IV);
2475 case MachineKeyValidation.TripleDES:
2476 if (cryptoStreamMode == CryptoStreamMode.Read){
2477 transform = TripleDES.Create().CreateDecryptor(vk, TripleDES_IV);
2479 transform = TripleDES.Create().CreateEncryptor(vk, TripleDES_IV);
2487 internal bool NeedViewStateEncryption {
2489 return (ViewStateEncryptionMode == ViewStateEncryptionMode.Always ||
2490 (ViewStateEncryptionMode == ViewStateEncryptionMode.Auto &&
2491 controlRegisteredForViewStateEncryption));
2496 void ApplyMasterPage ()
2498 if (masterPageFile != null && masterPageFile.Length > 0) {
2499 ArrayList appliedMasterPageFiles = new ArrayList ();
2501 if (Master != null) {
2502 MasterPage.ApplyMasterPageRecursive (Master, appliedMasterPageFiles);
2506 Controls.Add (Master);
2511 [DefaultValueAttribute ("")]
2512 public virtual string MasterPageFile {
2513 get { return masterPageFile; }
2515 masterPageFile = value;
2520 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
2521 [BrowsableAttribute (false)]
2522 public MasterPage Master {
2524 if (Context == null || String.IsNullOrEmpty (masterPageFile))
2527 if (masterPage == null)
2528 masterPage = MasterPage.CreateMasterPage (this, Context, masterPageFile, contentTemplates);
2534 public void SetFocus (string clientID)
2536 if (String.IsNullOrEmpty (clientID))
2537 throw new ArgumentNullException ("control");
2539 if (_lifeCycle > PageLifeCycle.PreRender)
2540 throw new InvalidOperationException ("SetFocus can only be called before and during PreRender.");
2543 throw new InvalidOperationException ("A form tag with runat=server must exist on the Page to use SetFocus() or the Focus property.");
2545 _focusedControlID = clientID;
2548 public void SetFocus (Control control)
2550 if (control == null)
2551 throw new ArgumentNullException ("control");
2553 SetFocus (control.ClientID);
2556 [EditorBrowsable (EditorBrowsableState.Advanced)]
2557 public void RegisterRequiresControlState (Control control)
2559 if (control == null)
2560 throw new ArgumentNullException ("control");
2562 if (RequiresControlState (control))
2565 if (requireStateControls == null)
2566 requireStateControls = new ArrayList ();
2567 int n = requireStateControls.Add (control);
2569 if (_savedControlState == null || n >= _savedControlState.Length)
2572 for (Control parent = control.Parent; parent != null; parent = parent.Parent)
2573 if (parent.IsChildControlStateCleared)
2576 object state = _savedControlState [n];
2578 control.LoadControlState (state);
2581 public bool RequiresControlState (Control control)
2583 if (requireStateControls == null) return false;
2584 return requireStateControls.Contains (control);
2587 [EditorBrowsable (EditorBrowsableState.Advanced)]
2588 public void UnregisterRequiresControlState (Control control)
2590 if (requireStateControls != null)
2591 requireStateControls.Remove (control);
2594 public ValidatorCollection GetValidators (string validationGroup)
2596 if (validationGroup == String.Empty)
2597 validationGroup = null;
2599 ValidatorCollection col = new ValidatorCollection ();
2600 if (_validators == null)
2603 foreach (IValidator v in _validators)
2604 if (BelongsToGroup(v, validationGroup))
2610 bool BelongsToGroup(IValidator v, string validationGroup) {
2611 BaseValidator validator = v as BaseValidator;
2612 if (validationGroup == null)
2613 return validator == null || String.IsNullOrEmpty (validator.ValidationGroup);
2615 return validator != null && validator.ValidationGroup == validationGroup;
2618 public virtual void Validate (string validationGroup)
2620 is_validated = true;
2621 ValidateCollection (GetValidators (validationGroup));
2624 object SavePageControlState ()
2626 if (requireStateControls == null) return null;
2627 object[] state = new object [requireStateControls.Count];
2629 bool allNull = true;
2630 for (int n=0; n<state.Length; n++) {
2631 state [n] = ((Control) requireStateControls [n]).SaveControlState ();
2632 if (state [n] != null) allNull = false;
2634 if (allNull) return null;
2638 void LoadPageControlState (object data)
2640 _savedControlState = (object []) data;
2642 if (requireStateControls == null) return;
2644 int max = Math.Min (requireStateControls.Count, _savedControlState != null ? _savedControlState.Length : requireStateControls.Count);
2645 for (int n=0; n < max; n++) {
2646 Control ctl = (Control) requireStateControls [n];
2647 ctl.LoadControlState (_savedControlState != null ? _savedControlState [n] : null);
2651 void LoadPreviousPageReference ()
2653 if (_requestValueCollection != null) {
2654 string prevPage = _requestValueCollection [PreviousPageID];
2655 if (prevPage != null) {
2657 if (getFacesContext () != null) {
2658 IHttpHandler handler = Context.ApplicationInstance.GetHandler (Context, prevPage);
2659 Server.Execute (handler, null, true, _context.Request.CurrentExecutionFilePath, null, false, false);
2660 if (_context.Items.Contains (CrossPagePostBack)) {
2661 previousPage = (Page) _context.Items [CrossPagePostBack];
2662 _context.Items.Remove (CrossPagePostBack);
2667 IHttpHandler handler = PageParser.GetCompiledPageInstance (prevPage, Server.MapPath (prevPage), Context);
2668 previousPage = (Page) handler;
2669 previousPage.isCrossPagePostBack = true;
2670 Server.Execute (handler, null, true, _context.Request.CurrentExecutionFilePath, null, false, false);
2677 Hashtable contentTemplates;
2678 [EditorBrowsable (EditorBrowsableState.Never)]
2679 protected internal void AddContentTemplate (string templateName, ITemplate template)
2681 if (contentTemplates == null)
2682 contentTemplates = new Hashtable ();
2683 contentTemplates [templateName] = template;
2686 PageTheme _pageTheme;
2687 internal PageTheme PageTheme {
2688 get { return _pageTheme; }
2691 PageTheme _styleSheetPageTheme;
2692 internal PageTheme StyleSheetPageTheme {
2693 get { return _styleSheetPageTheme; }
2698 internal void PushDataItemContext (object o) {
2699 if (dataItemCtx == null)
2700 dataItemCtx = new Stack ();
2702 dataItemCtx.Push (o);
2705 internal void PopDataItemContext () {
2706 if (dataItemCtx == null)
2707 throw new InvalidOperationException ();
2712 public object GetDataItem() {
2713 if (dataItemCtx == null || dataItemCtx.Count == 0)
2714 throw new InvalidOperationException ("No data item");
2716 return dataItemCtx.Peek ();
2719 protected internal override void OnInit (EventArgs e)
2723 ArrayList themes = new ArrayList();
2725 if (StyleSheetPageTheme != null && StyleSheetPageTheme.GetStyleSheets () != null)
2726 themes.AddRange (StyleSheetPageTheme.GetStyleSheets ());
2727 if (PageTheme != null && PageTheme.GetStyleSheets () != null)
2728 themes.AddRange (PageTheme.GetStyleSheets ());
2730 if (themes.Count > 0 && Header == null)
2731 throw new InvalidOperationException ("Using themed css files requires a header control on the page.");
2733 foreach (string lss in themes) {
2734 HtmlLink hl = new HtmlLink ();
2736 hl.Attributes["type"] = "text/css";
2737 hl.Attributes["rel"] = "stylesheet";
2738 Header.Controls.Add (hl);
2745 [MonoTODO ("Not implemented. Only used by .net aspx parser")]
2746 protected object GetWrappedFileDependencies (string [] list)
2751 [MonoTODO ("Does nothing. Used by .net aspx parser")]
2752 protected virtual void InitializeCulture ()
2756 [MonoTODO ("Does nothing. Used by .net aspx parser")]
2757 protected internal void AddWrappedFileDependencies (object virtualFileDependencies)