Example #1
0
        public override string ToString()
        {
            var page = new HtmlPage()
            { 
                new HtmlElement("div", "content")
                {
                    new HtmlElement("div", "title")
                    {
                        new Text(((int)Code).ToString())
                    },                
                    new HtmlElement("div", "bottomtext")
                    {
                        new Text(Message)
                    },
                }
            };
            page.Head.Add(new HtmlElement("style")
            {
                new Text(
@"
    html {
        height: 100%;
    }
    * {
        text-align: center;
        font-family: Verdana, sans-serif;
    }
    body {
        height: 100%;
    }
    #content {
        position: relative;
        top: 25%;
    }
    #title {
        font-size: 80px
    }
")
            });
            return page.ToString();
        }
Example #2
0
        public override void Process(HttpRequest request, HttpResponse response, HttpApplication application)
        {
            var encoding = Encoding.UTF8;
            int visitCount = 0;
            var t = request.Cookies["visitcount"];
            if (t != null)
                int.TryParse(t.Value, out visitCount);
            visitCount++;
            var page = new HtmlPage()
            { 
                new HtmlElement("div", "content")
                {
                    new HtmlElement("div", "toptext") { new Text("if you see it, then") },
                    new HtmlElement("div", "title") { new Text("NiL.WBE") },
                    new HtmlElement("div", "bottomtext") { new Text("working") },
                    new Text("you was here " + visitCount + " times")
                }
            };
            page.Head.Add(new HtmlElement("style")
            {
                new Text(
@"
    html {
        height: 100%;
    }
    * {
        text-align: center;
        font-family: Lobster;
    }
    body {
        height: 100%;
    }
    #content {
        position: relative;
        top: 25%;
    }
    #title {
        font-size: 80px
    }
    @font-face {
        font-family: 'Lobster';
        font-style: normal;
        font-weight: 400;
        src: local('Lobster'), url(http://themes.googleusercontent.com/static/fonts/lobster/v5/9eID_a1kLfzp_BP9s4L15g.woff) format('woff');
    }
", false)
            });
            try
            {
                page.Head.Add(new HtmlElement("title") { new Text("NiL.WBE") });
                response.ContentType = page.ContentType;
                response.ContentEncoding = System.Text.Encoding.UTF8;
                response.Cookies.Add(new HttpCookie("visitcount", visitCount.ToString()));
                response.Status = "200 OK";
                response.BinaryWrite(encoding.GetBytes(page.ToString()));
                application.CompleteRequest();
            }
            catch(Exception e)
            {
                string text = e.ToString();
            }
        }