- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
20 lines (17 loc) · 799 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
varapp=WebApplication.Create();
app.Run(async context =>
{
context.Response.Headers.Append("content-type","text/html");
awaitcontext.Response.WriteAsync("<html><body>");
awaitcontext.Response.WriteAsync("<h1>All query string</h1>");
awaitcontext.Response.WriteAsync(@"<a href=""?message=hello&message=world&message=again&isTrue=1&morning=good"">click this link to add query string</a><br/><br/>");
awaitcontext.Response.WriteAsync("<ul>");
foreach(varvincontext.Request.Query)
{
stringstr=v.Value;//implicit conversion from StringValues to String
awaitcontext.Response.WriteAsync($"<li>{v.Key} - {str}</li>");
}
awaitcontext.Response.WriteAsync("</ul>");
awaitcontext.Response.WriteAsync("</body></html>");
});
app.Run();