Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace EncodingAndDecoding
- {
- using System;
- using System.Net;
- class EncodingDecoding
- {
- static void Main()
- {
- //Decoding
- Console.WriteLine("Content-Type: text/html\r\n");
- 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>");
- string getContent = Environment.GetEnvironmentVariable("QUERY_STRING");
- string decoded = WebUtility.UrlDecode(getContent);
- Console.WriteLine(getContent);
- //Encoding
- string name = "Яна";
- string encoded = WebUtility.UrlEncode(name);
- Console.WriteLine(encoded);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment