- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
16 lines (14 loc) · 713 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 a single value</h1>");
awaitcontext.Response.WriteAsync(@"<a href=""?message=hello world"">click this link to add query string</a><br/><br/>");
awaitcontext.Response.WriteAsync($"'Message' query string: {queryString}");
awaitcontext.Response.WriteAsync("</body></html>");
});
app.Run();