-Annie-

PostOrGetMethod

Jan 28th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. namespace DecisionMaking
  2. {
  3.     using System;
  4.     public class DecisionMaking
  5.     {
  6.         static void Main()
  7.         {
  8.             Console.WriteLine("Content-Type: text/html\r\n");
  9.             Console.WriteLine("<!DOCTYPE html>\r\n<html>\r\n<head>\r\n\t<title>Example</title>\r\n</head>\r\n<body>\r\n\t<form action=\"DecisionMaking.exe\" method=\"POST\">\r\n\t\t<input type=\"text\" name=\"nickname\">\r\n\t\t<br/>\r\n\t\t<input type=\"submit\">\r\n\t</form>\r\n</body>\r\n</html>");
  10.             string method = Environment.GetEnvironmentVariable("REQUEST_METHOD");
  11.             Console.WriteLine(method);
  12.             method = method.ToLower();
  13.  
  14.             if (method == "get")
  15.             {
  16.                 Console.WriteLine("get");
  17.             }
  18.  
  19.             else if (method == "post")
  20.             {
  21.                 Console.WriteLine("post");
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment