March 2018
Beginner to intermediate
410 pages
10h 40m
English
The form will be sent using a Content-Type of application/x-www-form-urlencoded. This type is recognized by Waher.Content, and so decoding is simple. The form will be parsed into a string dictionary. All we need to do is to check that we get what we expect, and that the form has the correct parameters:
if (!req.HasData || req.Session == null)
throw new BadRequestException();
object Obj = req.DecodeData();
Dictionary<string, string> Form =
Obj as Dictionary<string, string>;
if (Form == null ||
!Form.TryGetValue("UserName", out string UserName) ||
!Form.TryGetValue("Password", out string Password))
{
throw new BadRequestException();
}
We also need to check the source of the original request, in case we want to redirect the ...
Read now
Unlock full access