-Annie-

EncodingAndDecoding

Jan 28th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. namespace EncodingAndDecoding
  2. {
  3.     using System;
  4.     using System.Net;
  5.     class EncodingDecoding
  6.     {
  7.         static void Main()
  8.         {
  9.             //Decoding
  10.             Console.WriteLine("Content-Type: text/html\r\n");
  11.             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=\"EncodingAndDecoding.exe\" method=\"GET\">\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>");
  12.             string getContent = Environment.GetEnvironmentVariable("QUERY_STRING");
  13.             string decoded = WebUtility.UrlDecode(getContent);
  14.             Console.WriteLine(getContent);
  15.  
  16.             //Encoding
  17.             string name = "Яна";
  18.             string encoded = WebUtility.UrlEncode(name);
  19.             Console.WriteLine(encoded);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment