bhylu.com

Advertisements

ASP Forms

Read a submitted quantity through a deliberate POST boundary.

How it works

A browser form sends name/value pairs, not trusted numbers. This lab accepts application/x-www-form-urlencoded POST requests and otherwise returns a short instruction. A write operation should reject unsupported methods rather than doing work on a GET request. The example only reports a quantity; it does not reserve a real seat.

Use the separate Windows lab

This is a legacy-maintenance course. Classic ASP uses IIS and VBScript; ASP.NET Web Pages uses .NET Framework and Razor. Neither runs in PHP, Apache or Bhylu’s browser playground. The reviewed baseline is 32-bit IIS Express 10.0.2001, .NET Framework 4.8, Web Pages / Razor 3.2.9 and the Windows VBScript engine. ADO database examples use the actual 32-bit Jet OLE DB 4.0 provider, not SQL Server or XAMPP MySQL.

Download download-lab.mjs into a separate empty learning folder. Run node download-lab.mjs to fetch hash-checked source files into a new bhylu-asp-lab folder, then cd bhylu-asp-lab and node run-lab.mjs --start. Before deployment, local preview uses node download-lab.mjs http://127.0.0.1:8000/examples/asp/. The source downloader refuses an existing destination. Review its source before running it.

The foreground launcher needs your own 32-bit IIS Express installation with Classic ASP, .NET Framework 4.8 and the VBScript engine available. It downloads the three pinned Web Pages packages from NuGet into its private cache, binds only localhost on port 8142 and stops when you press Ctrl+C. Keep its console open. Visit http://localhost:8142/forms.asp. It does not install IIS, enable Windows features, change Apache/PHP/MySQL, or publish any files. See the bundled README.txt for manual setup and test boundaries.

Each complete Classic ASP source requires the supplied Global.asa acknowledgement; Web Pages uses _PageStart.cshtml. Database and file examples create owned temporary files only under this private lab’s blocked App_Data folder. Sources are public text downloads; do not upload them as executable teaching endpoints on Bhylu.

Download forms.asp

Example

forms.asp

<%@ Language="VBScript" CodePage="65001" %>
<% Option Explicit
Response.Buffer = True
Response.ContentType = "text/plain"
Response.Charset = "utf-8"
If Application("BhyluLab") <> "YES" Then
    Response.Status = "403 Forbidden"
    Response.Write "Use the separate Bhylu learning lab."
    Response.End
End If
If Request.ServerVariables("REQUEST_METHOD") <> "POST" Then
    Response.Write "POST quantity=2"
    Response.End
End If
If Request.Form("quantity").Count <> 1 Then
    Response.Status = "400 Bad Request"
    Response.Write "One quantity required"
    Response.End
End If
Dim raw
raw = CStr(Request.Form("quantity"))
If raw <> "1" And raw <> "2" And raw <> "3" Then
    Response.Status = "400 Bad Request"
    Response.Write "Use 1, 2 or 3"
    Response.End
End If
Response.Write "Requested: " & CInt(raw)
%>

Focus on the lesson operations

This excerpt omits shared lab setup. Use the complete download and supporting files to run it.

Lesson excerpt

If Request.ServerVariables("REQUEST_METHOD") <> "POST" Then
    Response.Write "POST quantity=2"
    Response.End
End If
If Request.Form("quantity").Count <> 1 Then
    Response.Status = "400 Bad Request"
    Response.Write "One quantity required"
    Response.End
End If
Dim raw
raw = CStr(Request.Form("quantity"))
If raw <> "1" And raw <> "2" And raw <> "3" Then
    Response.Status = "400 Bad Request"
    Response.Write "Use 1, 2 or 3"
    Response.End
End If
Response.Write "Requested: " & CInt(raw)

Expected result

POST quantity=2

The allowlist is intentionally narrow: a seat quantity is one of three exact strings. The code does not accept decimals, signs, scientific notation or an empty value. These cases matter because a broad IsNumeric check accepts more than many forms intend.

Primary references

Advertisements