Exemple #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;
 }
Exemple #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;
 }
Exemple #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;
        }
Exemple #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;
        }