- Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathProgram.cs
30 lines (27 loc) · 912 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
25
26
27
28
29
30
usingMicrosoft.AspNetCore.WebUtilities;
varapp=WebApplication.Create();
app.Run(async context =>
{
varqueryString=QueryHelpers.ParseQuery(context.Request.QueryString.ToString());
varoutput="";
foreach(varqsinqueryString)
{
output+=qs.Key+" = "+qs.Value+"<br/>";
}
awaitcontext.Response.WriteAsync($@"<html>
<body>
<h1>Parsing Raw Query String</h1>
<ul>
<li><a href=""?name=anne"">?name=anne</a></li>
<li><a href=""?name=anne&name=annie"">?name=anne&name=annie</a></li>
<li><a href=""?age=25&smart=true"">?age=25&smart=true</a></li>
<li><a href=""?country=zambia&country=senegal&country="">?country=zambia&country=senegal&country=</a></li>
<li><a href=""?"">?</a></li>
<br /><br />
<strong>Query String</strong><br/>
{output}
</ul>
</body>
</html>");
});
app.Run();