Esempio n. 1
0
 public ActionResult POST()
 {
     var ar = new ActionResult();
     ar.CustomerHeader.Add("content-type", "application/json");
     ar.Body = Encoding.UTF8.GetBytes("now:" + DateTime.Now.ToString());
     return ar;
 }
Esempio n. 2
0
 public ActionResult GET()
 {
     //read the template
     var rawHtml = File.ReadAllText(@"Views\Blog.html");
     var ar = new ActionResult();
     ar.Body = Encoding.UTF8.GetBytes(rawHtml);
     ar.CustomerHeader.Add("content-type", "text/html");
     return ar;
 }
Esempio n. 3
0
        public ActionResult GET()
        {
            //read the template
            var rawHtml = File.ReadAllText(@"Views\Home.html");

            //render
            var newHtml = Regex.Replace(rawHtml, "{content}", "now:" + DateTime.Now);

            var ar = new ActionResult();
            ar.Body = Encoding.UTF8.GetBytes(newHtml);

            ar.CustomerHeader.Add("content-type", "text/html");

            return ar;
        }
Esempio n. 4
0
        public ActionResult GET()
        {
            var ar = new ActionResult();
            ar.CustomerHeader.Add("set-cookie", "id=" + Guid.NewGuid().ToString() + ";path=/;domain=localhost:9009");

            var html = @"
                <html>
                    <head><title>login</title></head>
                        <body>
                            <h3>Welcome to here ,you have loggined</h3>
            <a href='/'>back to home</a><br/>
            <a href='/home/blog'>back to blog</a><br/>
                        </body>
                </html>
                ";
            ar.Body = Encoding.UTF8.GetBytes(html);
            return ar;
        }