-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm.cs
More file actions
50 lines (42 loc) · 1.24 KB
/
Copy pathForm.cs
File metadata and controls
50 lines (42 loc) · 1.24 KB
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
41
42
43
44
45
46
47
48
49
50
/*
The contents of this file are provided under the CC0
"No rights reserved" license in the hopes it will be
useful.
Original Author: Robyn (robyn@mamallama.dev)
Notes:
There will be errors shown in your IDE because these
pages are not meant to be compiled. They are examples
you may copy into your /www/ folder for SharpWebserver
to compile and serve at runtime (where the namespace
won't be an issue)
*/
using System.Net;
using System.Text;
using SharpWebserver.Interop;
public class Webpage : IScriptPage
{
public byte[] CreatePage(HttpListenerRequest request)
{
StringBuilder buffer = new();
buffer.Append("""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Form Example</title>
</head>
<body>
<h1>Submit Your Name</h1>
<!-- Form starts here -->
<form action="Index.cs" method="post">
<label for="name">Enter your name:</label>
<input type="text" id="name" name="name" required>
<button type="submit">Submit</button>
</form>
</body>
</html>
""");
return Encoding.UTF8.GetBytes(buffer.ToString());
}
}