Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- public class BasePage : System.Web.UI.Page {
- public BasePage() {
- this.PreRender += Page_PreRender;
- }
- protected override void OnPreInit(EventArgs e) {
- if(Request.Cookies["Page"] != null) {
- if (Request.Cookies["Page"].Value != null) {
- Page.Theme = Request.Cookies["Page"].Value;
- System.Diagnostics.Debug.WriteLine("Theme is: " + Request.Cookies["Page"].Value);
- }
- }
- else {
- Page.Theme = "Monochrome";
- }
- base.OnPreInit(e);
- }
- private void Page_PreRender(Object sender, EventArgs s) {
- if(String.IsNullOrEmpty(this.Title) || this.Title.Equals("Untitled Page", StringComparison.CurrentCultureIgnoreCase))
- throw new Exception("Page title cannot be \"Untitled Page\" or an empty string...");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement