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;
56 namespace System.Web.UI
59 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
60 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
62 [RootDesignerSerializer ("Microsoft.VSDesigner.WebForms.RootCodeDomSerializer, " + Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design, true)]
64 [DefaultEvent ("Load"), DesignerCategory ("ASPXCodeBehind")]
67 [Designer ("Microsoft.VisualStudio.Web.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VisualStudio_Web, typeof (IRootDesigner))]
69 [Designer ("Microsoft.VSDesigner.WebForms.WebFormDesigner, " + Consts.AssemblyMicrosoft_VSDesigner, typeof (IRootDesigner))]
71 public class Page : TemplateControl, IHttpHandler
74 private bool _eventValidation = true;
76 private bool _viewState = true;
77 private bool _viewStateMac;
78 private string _errorPage;
79 private bool is_validated;
80 private bool _smartNavigation;
81 private int _transactionMode;
82 private HttpContext _context;
83 private ValidatorCollection _validators;
84 private bool renderingForm;
85 private object _savedViewState;
86 private ArrayList _requiresPostBack;
87 private ArrayList _requiresPostBackCopy;
88 private ArrayList requiresPostDataChanged;
89 private IPostBackEventHandler requiresRaiseEvent;
90 private NameValueCollection secondPostData;
91 private bool requiresPostBackScript;
92 private bool postBackScriptRendered;
94 string viewStateUserKey;
95 NameValueCollection _requestValueCollection;
97 ClientScriptManager scriptManager;
98 bool allow_load; // true when the Form collection belongs to this page (GetTypeHashCode)
100 [EditorBrowsable (EditorBrowsableState.Never)]
106 const string postEventArgumentID = "__EVENTARGUMENT";
108 [EditorBrowsable (EditorBrowsableState.Never)]
114 const string postEventSourceID = "__EVENTTARGET";
117 const string ScrollPositionXID = "__SCROLLPOSITIONX";
118 const string ScrollPositionYID = "__SCROLLPOSITIONY";
122 internal const string CallbackArgumentID = "__CALLBACKARGUMENT";
123 internal const string CallbackSourceID = "__CALLBACKTARGET";
124 internal const string PreviousPageID = "__PREVIOUSPAGE";
128 MasterPage masterPage;
129 string masterPageFile;
132 bool isCrossPagePostBack;
135 ArrayList requireStateControls;
136 Hashtable _validatorsByGroup;
141 string _styleSheetTheme;
144 bool _maintainScrollPositionOnPostBack;
150 scriptManager = new ClientScriptManager (this);
159 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
161 public HttpApplicationState Application
164 if (_context == null)
166 return _context.Application;
170 [EditorBrowsable (EditorBrowsableState.Never)]
171 protected bool AspCompatMode
174 get { return false; }
176 set { throw new NotImplementedException (); }
179 [EditorBrowsable (EditorBrowsableState.Never)]
181 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
182 [BrowsableAttribute (false)]
185 get { return Response.BufferOutput; }
186 set { Response.BufferOutput = value; }
189 protected bool Buffer
191 set { Response.BufferOutput = value; }
195 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
200 if (_context == null)
201 throw new HttpException ("No cache available without a context.");
202 return _context.Cache;
207 [EditorBrowsableAttribute (EditorBrowsableState.Advanced)]
209 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
210 [Browsable (false), DefaultValue ("")]
211 [WebSysDescription ("Value do override the automatic browser detection and force the page to use the specified browser.")]
212 public string ClientTarget
214 get { return (clientTarget == null) ? "" : clientTarget; }
216 clientTarget = value;
222 [EditorBrowsable (EditorBrowsableState.Never)]
224 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
225 [BrowsableAttribute (false)]
228 get { return Response.ContentEncoding.CodePage; }
229 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
232 protected int CodePage
234 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
238 [EditorBrowsable (EditorBrowsableState.Never)]
240 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
241 [BrowsableAttribute (false)]
242 public string ContentType
244 get { return Response.ContentType; }
245 set { Response.ContentType = value; }
248 protected string ContentType
250 set { Response.ContentType = value; }
254 protected override HttpContext Context
257 if (_context == null)
258 return HttpContext.Current;
265 [EditorBrowsable (EditorBrowsableState.Advanced)]
266 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
267 [BrowsableAttribute (false)]
268 public string Culture
270 get { return Thread.CurrentThread.CurrentCulture.Name; }
271 set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
274 [EditorBrowsable (EditorBrowsableState.Never)]
275 protected string Culture
277 set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
282 public virtual bool EnableEventValidation {
283 get { return _eventValidation; }
284 set { _eventValidation = value;}
289 public override bool EnableViewState
291 get { return _viewState; }
292 set { _viewState = value; }
296 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
297 [BrowsableAttribute (false)]
299 [EditorBrowsable (EditorBrowsableState.Never)]
305 bool EnableViewStateMac
307 get { return _viewStateMac; }
308 set { _viewStateMac = value; }
311 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
312 [Browsable (false), DefaultValue ("")]
313 [WebSysDescription ("The URL of a page used for error redirection.")]
314 public string ErrorPage
316 get { return _errorPage; }
319 if (_context != null)
320 _context.ErrorPage = value;
327 [EditorBrowsable (EditorBrowsableState.Never)]
328 protected ArrayList FileDependencies
331 if (Response != null)
332 Response.AddFileDependencies (value);
338 [EditorBrowsable (EditorBrowsableState.Never)]
340 public override string ID
342 get { return base.ID; }
343 set { base.ID = value; }
346 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
348 public bool IsPostBack
354 return _requestValueCollection != null;
359 [EditorBrowsable (EditorBrowsableState.Never), Browsable (false)]
360 public bool IsReusable {
361 get { return false; }
364 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
366 public bool IsValid {
369 throw new HttpException (Locale.GetText ("Page hasn't been validated."));
372 foreach (IValidator val in Validators)
377 return ValidateCollection (_validators);
382 public IDictionary Items {
385 items = new Hashtable ();
391 [EditorBrowsable (EditorBrowsableState.Never)]
393 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
394 [BrowsableAttribute (false)]
396 get { return Thread.CurrentThread.CurrentCulture.LCID; }
397 set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
401 set { Thread.CurrentThread.CurrentCulture = new CultureInfo (value); }
407 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
408 public bool MaintainScrollPositionOnPostBack {
409 get { return _maintainScrollPositionOnPostBack; }
410 set { _maintainScrollPositionOnPostBack = value; }
415 public PageAdapter PageAdapter {
417 return (PageAdapter)Adapter;
422 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
424 public HttpRequest Request
427 if (_context != null)
428 return _context.Request;
430 throw new HttpException("Request is not available without context");
434 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
436 public HttpResponse Response
439 if (_context != null)
440 return _context.Response;
442 throw new HttpException ("Response is not available without context");
446 [EditorBrowsable (EditorBrowsableState.Never)]
448 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
449 [BrowsableAttribute (false)]
450 public string ResponseEncoding
452 get { return Response.ContentEncoding.WebName; }
453 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
456 protected string ResponseEncoding
458 set { Response.ContentEncoding = Encoding.GetEncoding (value); }
462 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
464 public HttpServerUtility Server
467 return Context.Server;
471 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
473 public virtual HttpSessionState Session
476 if (_context == null)
477 _context = HttpContext.Current;
479 if (_context == null)
480 throw new HttpException ("Session is not available without context");
482 if (_context.Session == null)
483 throw new HttpException ("Session state can only be used " +
484 "when enableSessionState is set to true, either " +
485 "in a configuration file or in the Page directive.");
487 return _context.Session;
492 [FilterableAttribute (false)]
496 public bool SmartNavigation
498 get { return _smartNavigation; }
499 set { _smartNavigation = value; }
503 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
506 public virtual string StyleSheetTheme {
507 get { return _styleSheetTheme; }
508 set { _styleSheetTheme = value; }
512 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
513 public virtual string Theme {
514 get { return _theme; }
515 set { _theme = value; }
518 void InitializeStyleSheet ()
520 if (_styleSheetTheme == null) {
521 PagesSection ps = WebConfigurationManager.GetSection ("system.web/pages") as PagesSection;
523 _styleSheetTheme = ps.StyleSheetTheme;
525 if (_styleSheetTheme != null && _styleSheetTheme != "")
526 _styleSheetPageTheme = ThemeDirectoryCompiler.GetCompiledInstance ("~/App_Themes/" + _styleSheetTheme + "/", _context);
529 void InitializeTheme ()
531 if (_theme == null) {
532 PagesSection ps = WebConfigurationManager.GetSection ("system.web/pages") as PagesSection;
536 if (_theme != null && _theme != "") {
537 _pageTheme = ThemeDirectoryCompiler.GetCompiledInstance ("~/App_Themes/" + _theme + "/", _context);
546 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
547 public string Title {
550 return htmlHeader.Title;
554 if (htmlHeader != null)
555 htmlHeader.Title = value;
562 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
564 public TraceContext Trace
566 get { return Context.Trace; }
569 [EditorBrowsable (EditorBrowsableState.Never)]
571 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
572 [BrowsableAttribute (false)]
573 public bool TraceEnabled
575 get { return Trace.IsEnabled; }
576 set { Trace.IsEnabled = value; }
579 protected bool TraceEnabled
581 set { Trace.IsEnabled = value; }
585 [EditorBrowsable (EditorBrowsableState.Never)]
587 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
588 [BrowsableAttribute (false)]
589 public TraceMode TraceModeValue
591 get { return Trace.TraceMode; }
592 set { Trace.TraceMode = value; }
595 protected TraceMode TraceModeValue
597 set { Trace.TraceMode = value; }
601 [EditorBrowsable (EditorBrowsableState.Never)]
602 protected int TransactionMode
605 get { return _transactionMode; }
607 set { _transactionMode = value; }
611 [EditorBrowsable (EditorBrowsableState.Advanced)]
612 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
613 [BrowsableAttribute (false)]
614 public string UICulture
616 get { return Thread.CurrentThread.CurrentUICulture.Name; }
617 set { Thread.CurrentThread.CurrentUICulture = new CultureInfo (value); }
620 [EditorBrowsable (EditorBrowsableState.Never)]
621 protected string UICulture
623 set { Thread.CurrentThread.CurrentUICulture = new CultureInfo (value); }
627 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
629 public IPrincipal User
631 get { return Context.User; }
634 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
636 public ValidatorCollection Validators
639 if (_validators == null)
640 _validators = new ValidatorCollection ();
645 [MonoTODO ("Use this when encrypting/decrypting ViewState")]
647 public string ViewStateUserKey {
648 get { return viewStateUserKey; }
649 set { viewStateUserKey = value; }
653 public override bool Visible
655 get { return base.Visible; }
656 set { base.Visible = value; }
663 [EditorBrowsable (EditorBrowsableState.Never)]
664 protected IAsyncResult AspCompatBeginProcessRequest (HttpContext context,
668 throw new NotImplementedException ();
671 [EditorBrowsable (EditorBrowsableState.Never)]
672 protected void AspCompatEndProcessRequest (IAsyncResult result)
674 throw new NotImplementedException ();
677 [EditorBrowsable (EditorBrowsableState.Advanced)]
678 protected virtual HtmlTextWriter CreateHtmlTextWriter (TextWriter tw)
680 return new HtmlTextWriter (tw);
683 [EditorBrowsable (EditorBrowsableState.Never)]
684 public void DesignerInitialize ()
686 InitRecursive (null);
689 [EditorBrowsable (EditorBrowsableState.Advanced)]
690 protected virtual NameValueCollection DeterminePostBackMode ()
692 if (_context == null)
695 HttpRequest req = _context.Request;
699 NameValueCollection coll = null;
700 if (0 == String.Compare (Request.HttpMethod, "POST", true, CultureInfo.InvariantCulture)) {
702 WebROCollection c = (WebROCollection) coll;
703 allow_load = !c.GotID;
705 c.ID = GetTypeHashCode ();
707 allow_load = (c.ID == GetTypeHashCode ());
710 coll = req.QueryString;
713 if (coll != null && coll ["__VIEWSTATE"] == null && coll ["__EVENTTARGET"] == null)
720 public override Control FindControl (string id) {
724 return base.FindControl (id);
731 [EditorBrowsable (EditorBrowsableState.Advanced)]
732 public string GetPostBackClientEvent (Control control, string argument)
734 return scriptManager.GetPostBackEventReference (control, argument);
740 [EditorBrowsable (EditorBrowsableState.Advanced)]
741 public string GetPostBackClientHyperlink (Control control, string argument)
743 return scriptManager.GetPostBackClientHyperlink (control, argument);
749 [EditorBrowsable (EditorBrowsableState.Advanced)]
750 public string GetPostBackEventReference (Control control)
752 return scriptManager.GetPostBackEventReference (control, "");
758 [EditorBrowsable (EditorBrowsableState.Advanced)]
759 public string GetPostBackEventReference (Control control, string argument)
761 return scriptManager.GetPostBackEventReference (control, argument);
764 internal void RequiresPostBackScript ()
766 requiresPostBackScript = true;
769 [EditorBrowsable (EditorBrowsableState.Never)]
770 public virtual int GetTypeHashCode ()
776 [MonoTODO("The following properties of OutputCacheParameters are silently ignored: CacheProfile, NoStore, SqlDependency")]
777 protected internal virtual void InitOutputCache(OutputCacheParameters cacheSettings)
779 if (cacheSettings.Enabled)
780 InitOutputCache(cacheSettings.Duration,
781 cacheSettings.VaryByHeader,
782 cacheSettings.VaryByCustom,
783 cacheSettings.Location,
784 cacheSettings.VaryByParam);
788 [EditorBrowsable (EditorBrowsableState.Never)]
789 protected virtual void InitOutputCache (int duration,
792 OutputCacheLocation location,
795 HttpCachePolicy cache = _context.Response.Cache;
796 bool set_vary = false;
799 case OutputCacheLocation.Any:
800 cache.SetCacheability (HttpCacheability.Public);
801 cache.SetMaxAge (new TimeSpan (0, 0, duration));
802 cache.SetLastModified (_context.Timestamp);
805 case OutputCacheLocation.Client:
806 cache.SetCacheability (HttpCacheability.Private);
807 cache.SetMaxAge (new TimeSpan (0, 0, duration));
808 cache.SetLastModified (_context.Timestamp);
810 case OutputCacheLocation.Downstream:
811 cache.SetCacheability (HttpCacheability.Public);
812 cache.SetMaxAge (new TimeSpan (0, 0, duration));
813 cache.SetLastModified (_context.Timestamp);
815 case OutputCacheLocation.Server:
816 cache.SetCacheability (HttpCacheability.Server);
819 case OutputCacheLocation.None:
824 if (varyByCustom != null)
825 cache.SetVaryByCustom (varyByCustom);
827 if (varyByParam != null && varyByParam.Length > 0) {
828 string[] prms = varyByParam.Split (';');
829 foreach (string p in prms)
830 cache.VaryByParams [p.Trim ()] = true;
831 cache.VaryByParams.IgnoreParams = false;
833 cache.VaryByParams.IgnoreParams = true;
836 if (varyByHeader != null && varyByHeader.Length > 0) {
837 string[] hdrs = varyByHeader.Split (';');
838 foreach (string h in hdrs)
839 cache.VaryByHeaders [h.Trim ()] = true;
843 cache.Duration = duration;
844 cache.SetExpires (_context.Timestamp.AddSeconds (duration));
850 [EditorBrowsable (EditorBrowsableState.Advanced)]
852 public bool IsClientScriptBlockRegistered (string key)
854 return scriptManager.IsClientScriptBlockRegistered (key);
860 [EditorBrowsable (EditorBrowsableState.Advanced)]
862 public bool IsStartupScriptRegistered (string key)
864 return scriptManager.IsStartupScriptRegistered (key);
867 public string MapPath (string virtualPath)
869 return Request.MapPath (virtualPath);
873 protected internal override void Render (HtmlTextWriter writer) {
874 if (MaintainScrollPositionOnPostBack) {
875 RequiresPostBackScript ();
877 string scriptUrl = ClientScript.GetWebResourceUrl (typeof (Page), "MaintainScrollPositionOnPostBack.js");
879 ClientScript.RegisterClientScriptInclude (typeof (Page), "MaintainScrollPositionOnPostBack.js", scriptUrl);
881 ClientScript.RegisterHiddenField (ScrollPositionXID, Request [ScrollPositionXID]);
882 ClientScript.RegisterHiddenField (ScrollPositionYID, Request [ScrollPositionYID]);
884 StringBuilder script = new StringBuilder ();
885 script.AppendLine ("<script type=\"text/javascript\">");
886 script.AppendLine ("<!--");
887 script.AppendLine ("theForm.oldSubmit = theForm.submit");
888 script.AppendLine ("theForm.submit = WebForm_SaveScrollPositionSubmit");
889 script.AppendLine ("theForm.oldOnSubmit = theForm.onsubmit");
890 script.AppendLine ("theForm.onsubmit = WebForm_SaveScrollPositionOnSubmit");
892 script.AppendLine ("theForm.oldOnLoad = window.onload");
893 script.AppendLine ("window.onload = WebForm_RestoreScrollPosition");
895 script.AppendLine ("// -->");
896 script.AppendLine ("</script>");
898 ClientScript.RegisterStartupScript (typeof (Page), "MaintainScrollPositionOnPostBackStartup", script.ToString());
900 base.Render (writer);
904 private void RenderPostBackScript (HtmlTextWriter writer, string formUniqueID)
906 writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventSourceID);
907 writer.WriteLine ("<input type=\"hidden\" name=\"{0}\" value=\"\" />", postEventArgumentID);
909 writer.WriteLine ("<script language=\"javascript\">");
910 writer.WriteLine ("<!--");
912 writer.WriteLine ("\tvar theForm;\n\tif (document.getElementById) {{ theForm = document.getElementById ('{0}'); }}", formUniqueID);
913 writer.WriteLine ("\telse {{ theForm = document.{0}; }}", formUniqueID);
914 writer.WriteLine ("\tfunction __doPostBack(eventTarget, eventArgument) {");
915 writer.WriteLine ("\t\ttheForm.{0}.value = eventTarget;", postEventSourceID);
916 writer.WriteLine ("\t\ttheForm.{0}.value = eventArgument;", postEventArgumentID);
917 writer.WriteLine ("\t\ttheForm.submit();");
918 writer.WriteLine ("\t}");
919 writer.WriteLine ("// -->");
920 writer.WriteLine ("</script>");
923 internal void OnFormRender (HtmlTextWriter writer, string formUniqueID)
926 throw new HttpException ("Only 1 HtmlForm is allowed per page.");
928 renderingForm = true;
930 scriptManager.WriteHiddenFields (writer);
931 if (requiresPostBackScript) {
932 RenderPostBackScript (writer, formUniqueID);
933 postBackScriptRendered = true;
936 if (handleViewState) {
937 string vs = GetViewStateString ();
938 writer.Write ("<input type=\"hidden\" name=\"__VIEWSTATE\" ");
939 writer.WriteLine ("value=\"{0}\" />", vs);
942 scriptManager.WriteClientScriptBlocks (writer);
945 LosFormatter GetFormatter ()
948 PagesSection config = (PagesSection) WebConfigurationManager.GetSection ("system.web/pages");
950 PagesConfiguration config = PagesConfiguration.GetInstance (_context);
953 if (config.EnableViewStateMac) {
955 MachineKeySection mconfig = (MachineKeySection) WebConfigurationManager.GetSection ("system.web/machineKey");
956 vkey = mconfig.ValidationKeyBytes;
958 MachineKeyConfig mconfig = HttpContext.GetAppConfig ("system.web/machineKey") as MachineKeyConfig;
959 vkey = mconfig.ValidationKey;
963 return new LosFormatter (config.EnableViewStateMac, vkey);
966 string GetViewStateString ()
968 if (_savedViewState == null)
971 LosFormatter fmt = GetFormatter ();
972 return fmt.SerializeToBase64 (_savedViewState);
975 internal object GetSavedViewState ()
977 return _savedViewState;
980 internal void OnFormPostRender (HtmlTextWriter writer, string formUniqueID)
982 scriptManager.WriteArrayDeclares (writer);
984 if (!postBackScriptRendered && requiresPostBackScript)
985 RenderPostBackScript (writer, formUniqueID);
987 scriptManager.WriteHiddenFields (writer);
988 scriptManager.WriteClientScriptIncludes (writer);
989 scriptManager.WriteStartupScriptBlocks (writer);
990 renderingForm = false;
991 postBackScriptRendered = false;
994 private void ProcessPostData (NameValueCollection data, bool second)
999 if (_requiresPostBackCopy == null && _requiresPostBack != null)
1000 _requiresPostBackCopy = (ArrayList) _requiresPostBack.Clone ();
1002 Hashtable used = new Hashtable ();
1003 foreach (string id in data.AllKeys){
1004 if (id == "__VIEWSTATE" || id == postEventSourceID || id == postEventArgumentID)
1007 string real_id = id;
1008 int dot = real_id.IndexOf ('.');
1010 real_id = real_id.Substring (0, dot);
1012 if (real_id == null || used.ContainsKey (real_id))
1015 used.Add (real_id, real_id);
1017 Control ctrl = FindControl (real_id);
1019 IPostBackDataHandler pbdh = ctrl as IPostBackDataHandler;
1020 IPostBackEventHandler pbeh = ctrl as IPostBackEventHandler;
1024 RegisterRequiresRaiseEvent (pbeh);
1028 if (pbdh.LoadPostData (real_id, data) == true) {
1029 if (requiresPostDataChanged == null)
1030 requiresPostDataChanged = new ArrayList ();
1031 requiresPostDataChanged.Add (pbdh);
1032 if (_requiresPostBackCopy != null)
1033 _requiresPostBackCopy.Remove (ctrl.UniqueID);
1035 } else if (!second) {
1036 if (secondPostData == null)
1037 secondPostData = new NameValueCollection ();
1038 secondPostData.Add (real_id, data [id]);
1042 ArrayList list1 = null;
1043 if (_requiresPostBackCopy != null && _requiresPostBackCopy.Count > 0) {
1044 string [] handlers = (string []) _requiresPostBackCopy.ToArray (typeof (string));
1045 foreach (string id in handlers) {
1046 IPostBackDataHandler pbdh = FindControl (id) as IPostBackDataHandler;
1048 _requiresPostBackCopy.Remove (id);
1049 if (pbdh.LoadPostData (id, data)) {
1050 if (requiresPostDataChanged == null)
1051 requiresPostDataChanged = new ArrayList ();
1053 requiresPostDataChanged.Add (pbdh);
1055 } else if (second) {
1057 list1 = new ArrayList ();
1062 _requiresPostBack = list1;
1065 [EditorBrowsable (EditorBrowsableState.Never)]
1066 #if NET_2_0 || TARGET_JVM
1067 public virtual void ProcessRequest (HttpContext context)
1069 public void ProcessRequest (HttpContext context)
1073 if (clientTarget != null)
1074 Request.ClientTarget = clientTarget;
1076 WireupAutomaticEvents ();
1077 //-- Control execution lifecycle in the docs
1079 // Save culture information because it can be modified in FrameworkInitialize()
1080 CultureInfo culture = Thread.CurrentThread.CurrentCulture;
1081 CultureInfo uiculture = Thread.CurrentThread.CurrentUICulture;
1082 FrameworkInitialize ();
1083 context.ErrorPage = _errorPage;
1086 InternalProcessRequest ();
1087 } catch (ThreadAbortException) {
1088 // Do nothing, just ignore it by now.
1089 } catch (Exception e) {
1090 context.AddError (e); // OnError might access LastError
1091 OnError (EventArgs.Empty);
1092 context.ClearError (e);
1093 // We want to remove that error, as we're rethrowing to stop
1094 // further processing.
1095 Trace.Warn ("Unhandled Exception", e.ToString (), e);
1100 UnloadRecursive (true);
1102 if (Thread.CurrentThread.CurrentCulture.Equals (culture) == false)
1103 Thread.CurrentThread.CurrentCulture = culture;
1105 if (Thread.CurrentThread.CurrentUICulture.Equals (uiculture) == false)
1106 Thread.CurrentThread.CurrentUICulture = uiculture;
1111 internal void ProcessCrossPagePostBack (HttpContext context)
1113 isCrossPagePostBack = true;
1114 ProcessRequest (context);
1118 void InternalProcessRequest ()
1120 _requestValueCollection = this.DeterminePostBackMode();
1123 // http://msdn2.microsoft.com/en-us/library/ms178141.aspx
1124 if (_requestValueCollection != null) {
1125 if (!isCrossPagePostBack && _requestValueCollection [PreviousPageID] != null && _requestValueCollection [PreviousPageID] != Request.FilePath) {
1126 LoadPreviousPageReference ();
1129 isCallback = _requestValueCollection [CallbackArgumentID] != null;
1130 isPostBack = !isCallback;
1134 OnPreInit (EventArgs.Empty);
1139 Trace.Write ("aspx.page", "Begin Init");
1140 InitRecursive (null);
1141 Trace.Write ("aspx.page", "End Init");
1144 OnInitComplete (EventArgs.Empty);
1147 renderingForm = false;
1149 Trace.Write ("aspx.page", "Begin LoadViewState");
1150 LoadPageViewState ();
1151 Trace.Write ("aspx.page", "End LoadViewState");
1152 Trace.Write ("aspx.page", "Begin ProcessPostData");
1153 ProcessPostData (_requestValueCollection, false);
1154 Trace.Write ("aspx.page", "End ProcessPostData");
1158 OnPreLoad (EventArgs.Empty);
1163 Trace.Write ("aspx.page", "Begin ProcessPostData Second Try");
1164 ProcessPostData (secondPostData, true);
1165 Trace.Write ("aspx.page", "End ProcessPostData Second Try");
1166 Trace.Write ("aspx.page", "Begin Raise ChangedEvents");
1167 RaiseChangedEvents ();
1168 Trace.Write ("aspx.page", "End Raise ChangedEvents");
1169 Trace.Write ("aspx.page", "Begin Raise PostBackEvent");
1170 RaisePostBackEvents ();
1171 Trace.Write ("aspx.page", "End Raise PostBackEvent");
1175 OnLoadComplete (EventArgs.Empty);
1177 if (IsCrossPagePostBack)
1181 string result = ProcessCallbackData ();
1182 HtmlTextWriter callbackOutput = new HtmlTextWriter (_context.Response.Output);
1183 callbackOutput.Write (result);
1184 callbackOutput.Flush ();
1189 Trace.Write ("aspx.page", "Begin PreRender");
1190 PreRenderRecursiveInternal ();
1191 Trace.Write ("aspx.page", "End PreRender");
1194 OnPreRenderComplete (EventArgs.Empty);
1197 Trace.Write ("aspx.page", "Begin SaveViewState");
1198 SavePageViewState ();
1199 Trace.Write ("aspx.page", "End SaveViewState");
1202 OnSaveStateComplete (EventArgs.Empty);
1206 Trace.Write ("aspx.page", "Begin Render");
1207 HtmlTextWriter output = new HtmlTextWriter (_context.Response.Output);
1208 RenderControl (output);
1209 Trace.Write ("aspx.page", "End Render");
1212 private void RenderTrace ()
1214 TraceManager traceManager = HttpRuntime.TraceManager;
1216 if (Trace.HaveTrace && !Trace.IsEnabled || !Trace.HaveTrace && !traceManager.Enabled)
1221 if (!Trace.HaveTrace && traceManager.Enabled && !traceManager.PageOutput)
1224 if (!traceManager.LocalOnly || Context.Request.IsLocal) {
1225 HtmlTextWriter output = new HtmlTextWriter (_context.Response.Output);
1226 Trace.Render (output);
1230 void RaisePostBackEvents ()
1232 if (requiresRaiseEvent != null) {
1233 RaisePostBackEvent (requiresRaiseEvent, null);
1237 NameValueCollection postdata = _requestValueCollection;
1238 if (postdata == null)
1241 string eventTarget = postdata [postEventSourceID];
1242 if (eventTarget == null || eventTarget.Length == 0) {
1247 IPostBackEventHandler target = FindControl (eventTarget) as IPostBackEventHandler;
1251 string eventArgument = postdata [postEventArgumentID];
1252 RaisePostBackEvent (target, eventArgument);
1255 internal void RaiseChangedEvents ()
1257 if (requiresPostDataChanged == null)
1260 foreach (IPostBackDataHandler ipdh in requiresPostDataChanged)
1261 ipdh.RaisePostDataChangedEvent ();
1263 requiresPostDataChanged = null;
1266 [EditorBrowsable (EditorBrowsableState.Advanced)]
1267 protected virtual void RaisePostBackEvent (IPostBackEventHandler sourceControl, string eventArgument)
1269 sourceControl.RaisePostBackEvent (eventArgument);
1275 [EditorBrowsable (EditorBrowsableState.Advanced)]
1276 public void RegisterArrayDeclaration (string arrayName, string arrayValue)
1278 scriptManager.RegisterArrayDeclaration (arrayName, arrayValue);
1284 [EditorBrowsable (EditorBrowsableState.Advanced)]
1285 public virtual void RegisterClientScriptBlock (string key, string script)
1287 scriptManager.RegisterClientScriptBlock (key, script);
1293 [EditorBrowsable (EditorBrowsableState.Advanced)]
1294 public virtual void RegisterHiddenField (string hiddenFieldName, string hiddenFieldInitialValue)
1296 scriptManager.RegisterHiddenField (hiddenFieldName, hiddenFieldInitialValue);
1299 [MonoTODO("Used in HtmlForm")]
1300 internal void RegisterClientScriptFile (string a, string b, string c)
1302 throw new NotImplementedException ();
1308 [EditorBrowsable (EditorBrowsableState.Advanced)]
1309 public void RegisterOnSubmitStatement (string key, string script)
1311 scriptManager.RegisterOnSubmitStatement (key, script);
1314 internal string GetSubmitStatements ()
1316 return scriptManager.WriteSubmitStatements ();
1319 [EditorBrowsable (EditorBrowsableState.Advanced)]
1320 public void RegisterRequiresPostBack (Control control)
1322 if (_requiresPostBack == null)
1323 _requiresPostBack = new ArrayList ();
1325 _requiresPostBack.Add (control.UniqueID);
1328 [EditorBrowsable (EditorBrowsableState.Advanced)]
1329 public virtual void RegisterRequiresRaiseEvent (IPostBackEventHandler control)
1331 requiresRaiseEvent = control;
1337 [EditorBrowsable (EditorBrowsableState.Advanced)]
1338 public virtual void RegisterStartupScript (string key, string script)
1340 scriptManager.RegisterStartupScript (key, script);
1343 [EditorBrowsable (EditorBrowsableState.Advanced)]
1344 public void RegisterViewStateHandler ()
1346 handleViewState = true;
1349 [EditorBrowsable (EditorBrowsableState.Advanced)]
1350 protected virtual void SavePageStateToPersistenceMedium (object viewState)
1352 _savedViewState = viewState;
1355 [EditorBrowsable (EditorBrowsableState.Advanced)]
1356 protected virtual object LoadPageStateFromPersistenceMedium ()
1358 NameValueCollection postdata = _requestValueCollection;
1360 if (postdata == null || (view_state = postdata ["__VIEWSTATE"]) == null)
1363 _savedViewState = null;
1364 if (view_state == "")
1367 LosFormatter fmt = GetFormatter ();
1369 _savedViewState = fmt.Deserialize (view_state);
1370 } catch (Exception e) {
1371 throw new HttpException ("Error restoring page viewstate.", e);
1373 return _savedViewState;
1376 internal void LoadPageViewState()
1378 object sState = LoadPageStateFromPersistenceMedium ();
1379 if (sState != null) {
1381 Triplet data = (Triplet) sState;
1383 LoadPageControlState (data.Third);
1384 LoadViewStateRecursive (data.First);
1385 _requiresPostBack = data.Second as ArrayList;
1388 Pair pair = (Pair) sState;
1390 LoadViewStateRecursive (pair.First);
1391 _requiresPostBack = pair.Second as ArrayList;
1397 internal void SavePageViewState ()
1399 if (!handleViewState)
1403 object controlState = SavePageControlState ();
1406 object viewState = SaveViewStateRecursive ();
1407 object reqPostback = (_requiresPostBack != null && _requiresPostBack.Count > 0) ? _requiresPostBack : null;
1410 Triplet triplet = new Triplet ();
1411 triplet.First = viewState;
1412 triplet.Second = reqPostback;
1413 triplet.Third = controlState;
1415 if (triplet.First == null && triplet.Second == null && triplet.Third == null)
1418 SavePageStateToPersistenceMedium (triplet);
1420 Pair pair = new Pair ();
1421 pair.First = viewState;
1422 pair.Second = reqPostback;
1424 if (pair.First == null && pair.Second == null)
1427 SavePageStateToPersistenceMedium (pair);
1431 public virtual void Validate ()
1433 is_validated = true;
1434 ValidateCollection (_validators);
1438 internal bool AreValidatorsUplevel () {
1439 return AreValidatorsUplevel (String.Empty);
1442 internal bool AreValidatorsUplevel (string valGroup)
1444 internal virtual bool AreValidatorsUplevel ()
1447 bool uplevel = false;
1449 foreach (IValidator v in Validators) {
1450 BaseValidator bv = v as BaseValidator;
1451 if (bv == null) continue;
1454 if (valGroup != bv.ValidationGroup)
1457 if (bv.GetRenderUplevel()) {
1466 bool ValidateCollection (ValidatorCollection validators)
1469 if (!_eventValidation)
1473 if (validators == null || validators.Count == 0)
1476 bool all_valid = true;
1477 foreach (IValidator v in validators){
1479 if (v.IsValid == false)
1486 [EditorBrowsable (EditorBrowsableState.Advanced)]
1487 public virtual void VerifyRenderingInServerForm (Control control)
1489 if (_context == null)
1493 throw new HttpException ("Control '" +
1496 control.GetType ().Name +
1497 "' must be placed inside a form tag with runat=server.");
1500 protected override void FrameworkInitialize ()
1502 base.FrameworkInitialize ();
1504 InitializeStyleSheet ();
1515 ClientScriptManager ClientScript {
1516 get { return scriptManager; }
1521 static readonly object InitCompleteEvent = new object ();
1522 static readonly object LoadCompleteEvent = new object ();
1523 static readonly object PreInitEvent = new object ();
1524 static readonly object PreLoadEvent = new object ();
1525 static readonly object PreRenderCompleteEvent = new object ();
1526 static readonly object SaveStateCompleteEvent = new object ();
1528 const int initcomplete_mask = 1;
1529 const int loadcomplete_mask = 1 << 1;
1530 const int preinit_mask = 1 << 2;
1531 const int preload_mask = 1 << 3;
1532 const int prerendercomplete_mask = 1 << 4;
1533 const int savestatecomplete_mask = 1 << 5;
1535 [EditorBrowsable (EditorBrowsableState.Advanced)]
1536 public event EventHandler InitComplete {
1538 event_mask |= initcomplete_mask;
1539 Events.AddHandler (InitCompleteEvent, value);
1541 remove { Events.RemoveHandler (InitCompleteEvent, value); }
1544 [EditorBrowsable (EditorBrowsableState.Advanced)]
1545 public event EventHandler LoadComplete {
1547 event_mask |= loadcomplete_mask;
1548 Events.AddHandler (LoadCompleteEvent, value);
1550 remove { Events.RemoveHandler (LoadCompleteEvent, value); }
1553 public event EventHandler PreInit {
1555 event_mask |= preinit_mask;
1556 Events.AddHandler (PreInitEvent, value);
1558 remove { Events.RemoveHandler (PreInitEvent, value); }
1561 [EditorBrowsable (EditorBrowsableState.Advanced)]
1562 public event EventHandler PreLoad {
1564 event_mask |= preload_mask;
1565 Events.AddHandler (PreLoadEvent, value);
1567 remove { Events.RemoveHandler (PreLoadEvent, value); }
1570 [EditorBrowsable (EditorBrowsableState.Advanced)]
1571 public event EventHandler PreRenderComplete {
1573 event_mask |= prerendercomplete_mask;
1574 Events.AddHandler (PreRenderCompleteEvent, value);
1576 remove { Events.RemoveHandler (PreRenderCompleteEvent, value); }
1579 [EditorBrowsable (EditorBrowsableState.Advanced)]
1580 public event EventHandler SaveStateComplete {
1582 event_mask |= savestatecomplete_mask;
1583 Events.AddHandler (SaveStateCompleteEvent, value);
1585 remove { Events.RemoveHandler (SaveStateCompleteEvent, value); }
1588 protected virtual void OnInitComplete (EventArgs e)
1590 if ((event_mask & initcomplete_mask) != 0) {
1591 EventHandler eh = (EventHandler) (Events [InitCompleteEvent]);
1592 if (eh != null) eh (this, e);
1596 protected virtual void OnLoadComplete (EventArgs e)
1598 if ((event_mask & loadcomplete_mask) != 0) {
1599 EventHandler eh = (EventHandler) (Events [LoadCompleteEvent]);
1600 if (eh != null) eh (this, e);
1604 protected virtual void OnPreInit (EventArgs e)
1606 if ((event_mask & preinit_mask) != 0) {
1607 EventHandler eh = (EventHandler) (Events [PreInitEvent]);
1608 if (eh != null) eh (this, e);
1612 protected virtual void OnPreLoad (EventArgs e)
1614 if ((event_mask & preload_mask) != 0) {
1615 EventHandler eh = (EventHandler) (Events [PreLoadEvent]);
1616 if (eh != null) eh (this, e);
1620 protected virtual void OnPreRenderComplete (EventArgs e)
1622 if ((event_mask & prerendercomplete_mask) != 0) {
1623 EventHandler eh = (EventHandler) (Events [PreRenderCompleteEvent]);
1624 if (eh != null) eh (this, e);
1628 protected virtual void OnSaveStateComplete (EventArgs e)
1630 if ((event_mask & savestatecomplete_mask) != 0) {
1631 EventHandler eh = (EventHandler) (Events [SaveStateCompleteEvent]);
1632 if (eh != null) eh (this, e);
1636 public HtmlForm Form {
1637 get { return _form; }
1640 internal void RegisterForm (HtmlForm form)
1645 [BrowsableAttribute (false)]
1646 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
1647 public Page PreviousPage {
1648 get { return previousPage; }
1652 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
1653 [BrowsableAttribute (false)]
1654 public bool IsCallback {
1655 get { return isCallback; }
1658 [BrowsableAttribute (false)]
1659 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
1660 public bool IsCrossPagePostBack {
1661 get { return isCrossPagePostBack; }
1664 string ProcessCallbackData ()
1666 string callbackTarget = _requestValueCollection [CallbackSourceID];
1667 if (callbackTarget == null || callbackTarget.Length == 0)
1668 throw new HttpException ("Callback target not provided.");
1670 ICallbackEventHandler target = FindControl (callbackTarget) as ICallbackEventHandler;
1672 throw new HttpException (string.Format ("Invalid callback target '{0}'.", callbackTarget));
1674 string callbackArgument = _requestValueCollection [CallbackArgumentID];
1675 target.RaiseCallbackEvent (callbackArgument);
1676 return target.GetCallbackResult ();
1679 [BrowsableAttribute (false)]
1680 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
1681 public HtmlHead Header {
1682 get { return htmlHeader; }
1685 internal void SetHeader (HtmlHead header)
1687 htmlHeader = header;
1688 if (_title != null) {
1689 htmlHeader.Title = _title;
1694 void ApplyMasterPage ()
1696 if (masterPageFile != null && masterPageFile.Length > 0) {
1697 ArrayList appliedMasterPageFiles = new ArrayList ();
1699 if (Master != null) {
1700 MasterPage.ApplyMasterPageRecursive (Master, appliedMasterPageFiles);
1704 Controls.Add (Master);
1709 [DefaultValueAttribute ("")]
1710 public virtual string MasterPageFile {
1711 get { return masterPageFile; }
1713 masterPageFile = value;
1718 [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
1719 [BrowsableAttribute (false)]
1720 public MasterPage Master {
1722 if (masterPage == null)
1723 masterPage = MasterPage.CreateMasterPage (this, Context, masterPageFile, contentTemplates);
1729 [EditorBrowsable (EditorBrowsableState.Advanced)]
1730 public void RegisterRequiresControlState (Control control)
1732 if (requireStateControls == null) requireStateControls = new ArrayList ();
1733 requireStateControls.Add (control);
1736 public bool RequiresControlState (Control control)
1738 if (requireStateControls == null) return false;
1739 return requireStateControls.Contains (control);
1742 [EditorBrowsable (EditorBrowsableState.Advanced)]
1743 public void UnregisterRequiresControlState (Control control)
1745 if (requireStateControls != null)
1746 requireStateControls.Remove (control);
1749 public ValidatorCollection GetValidators (string validationGroup)
1751 string valgr = validationGroup;
1753 valgr = String.Empty;
1755 if (_validatorsByGroup == null) _validatorsByGroup = new Hashtable ();
1756 ValidatorCollection col = _validatorsByGroup [valgr] as ValidatorCollection;
1758 col = new ValidatorCollection ();
1759 _validatorsByGroup [valgr] = col;
1764 public virtual void Validate (string validationGroup)
1766 is_validated = true;
1767 if (validationGroup == null)
1768 ValidateCollection (_validatorsByGroup [String.Empty] as ValidatorCollection);
1769 else if (_validatorsByGroup != null) {
1770 ValidateCollection (_validatorsByGroup [validationGroup] as ValidatorCollection);
1774 object SavePageControlState ()
1776 if (requireStateControls == null) return null;
1777 object[] state = new object [requireStateControls.Count];
1779 bool allNull = true;
1780 for (int n=0; n<state.Length; n++) {
1781 state [n] = ((Control) requireStateControls [n]).SaveControlState ();
1782 if (state [n] != null) allNull = false;
1784 if (allNull) return null;
1788 void LoadPageControlState (object data)
1790 if (requireStateControls == null) return;
1792 object[] state = (object[]) data;
1793 int max = Math.Min (requireStateControls.Count, state != null ? state.Length : requireStateControls.Count);
1794 for (int n=0; n < max; n++) {
1795 Control ctl = (Control) requireStateControls [n];
1796 ctl.LoadControlState (state != null ? state [n] : null);
1800 void LoadPreviousPageReference ()
1802 if (_requestValueCollection != null) {
1803 string prevPage = _requestValueCollection [PreviousPageID];
1804 if (prevPage != null) {
1805 previousPage = (Page) PageParser.GetCompiledPageInstance (prevPage, Server.MapPath (prevPage), Context);
1806 previousPage.ProcessCrossPagePostBack (_context);
1808 previousPage = _context.LastPage;
1811 _context.LastPage = this;
1815 Hashtable contentTemplates;
1816 [EditorBrowsable (EditorBrowsableState.Never)]
1817 protected internal void AddContentTemplate (string templateName, ITemplate template)
1819 if (contentTemplates == null)
1820 contentTemplates = new Hashtable ();
1821 contentTemplates [templateName] = template;
1824 PageTheme _pageTheme;
1825 internal PageTheme PageTheme {
1826 get { return _pageTheme; }
1829 PageTheme _styleSheetPageTheme;
1830 internal PageTheme StyleSheetPageTheme {
1831 get { return _styleSheetPageTheme; }
1836 internal void PushDataItemContext (object o) {
1837 if (dataItemCtx == null)
1838 dataItemCtx = new Stack ();
1840 dataItemCtx.Push (o);
1843 internal void PopDataItemContext () {
1844 if (dataItemCtx == null)
1845 throw new InvalidOperationException ();
1850 public object GetDataItem() {
1851 if (dataItemCtx == null || dataItemCtx.Count == 0)
1852 throw new InvalidOperationException ("No data item");
1854 return dataItemCtx.Peek ();
1857 protected internal override void OnInit (EventArgs e)
1863 ArrayList themes = new ArrayList();
1865 if (StyleSheetPageTheme != null && StyleSheetPageTheme.GetStyleSheets () != null)
1866 themes.AddRange (StyleSheetPageTheme.GetStyleSheets ());
1867 if (PageTheme != null && PageTheme.GetStyleSheets () != null)
1868 themes.AddRange (PageTheme.GetStyleSheets ());
1870 foreach (string lss in themes) {
1871 HtmlLink hl = new HtmlLink ();
1872 hl.Href = ResolveUrl (lss);
1873 hl.Attributes["type"] = "text/css";
1874 hl.Attributes["rel"] = "stylesheet";
1875 Header.Controls.Add (hl);
1882 [MonoTODO ("Used by .net aspx parser")]
1883 protected object GetWrappedFileDependencies (string [] list)
1888 [MonoTODO ("Used by .net aspx parser")]
1889 protected virtual void InitializeCulture ()
1893 [MonoTODO ("Used by .net aspx parser")]
1894 protected internal void AddWrappedFileDependencies (object virtualFileDependencies)