- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
24 lines (19 loc) · 863 Bytes
/
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
usingMicrosoft.Extensions.Primitives;
varapp=WebApplication.Create();
//These are the three default services available at Configure
app.Run(async context =>
{
context.Response.Headers.Append("Content-Type","text/html");
StringValuesqueryString=context.Request.Query["message"];
awaitcontext.Response.WriteAsync("<html><body>");
awaitcontext.Response.WriteAsync("<h1>Query String with multiple values</h1>");
awaitcontext.Response.WriteAsync(@"<a href=""?message=hello&message=world&message=again"">click this link to add query string</a><br/><br/>");
awaitcontext.Response.WriteAsync("<ul>");
foreach(stringvinqueryString)
{
awaitcontext.Response.WriteAsync($"<li>{v}</li>");
}
awaitcontext.Response.WriteAsync("</ul>");
awaitcontext.Response.WriteAsync("</body></html>");
});
app.Run();