- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
40 lines (36 loc) · 1.29 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
varapp=WebApplication.Create();
app.Run(async context =>
{
vardicts=newDictionary<string,string>()
{
["id"]="10",
["name"]="dody gunawinata",
["date"]="2020/05/30",
["date2"]="2020-05-30",
["guid"]=System.Guid.NewGuid().ToString(),
["artist"]="Simon & Garfunkel",
["formula"]="10 = 10 * 1"
};
varqueryString=QueryString.Create(dicts);
context.Response.Headers.Append("Content-Type","text/html");
awaitcontext.Response.WriteAsync($@"<html>
<head>
<link rel=""stylesheet"" href=""https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.css"" />
</head>
<body class=""content"">
<div class=""container"">
<h1>Using QueryString.Create to get URL encoded query string</h1>
<strong>Input</strong>
");
awaitcontext.Response.WriteAsync("<ul>");
foreach(varkindicts)
{
awaitcontext.Response.WriteAsync($"<li>{k.Key} = {k.Value}</li>");
}
awaitcontext.Response.WriteAsync("</ul>");
awaitcontext.Response.WriteAsync("<strong>Output</strong><br/>");
awaitcontext.Response.WriteAsync(queryString.Value);
awaitcontext.Response.WriteAsync("</ul>");
awaitcontext.Response.WriteAsync(@"</div></body></html>");
});
app.Run();