Here is one way to write the ASP script,
readform.asp
.
Submitting the HTML Form runs your ASP script, reads the text data, and writes it back to the browser:
<html>
<head>
<title>Module 3 - Exercise 5 Solution</title>
</head>
<body >
<div align="center">
<p><b><font size="+2">Module 3 - Exercise 5 Solution
</font></b></p>
<% Response.Write "Welcome " & Request.Form("txtName")
& "!" %>
<p> </p>
</div>
</results>
</html>
.
<form name="frmWelcome" method="post" action="readform.asp">
.
<input type="text" name="txtName" size="30">
To run the equivalent ASP script on ASP.NET (particularly for a Windows Server on Azure), you will want to transition from
- classic ASP syntax** (`<% %>`) to
- ASP.NET Web Forms or ASP.NET Core.
Below is an updated ASP.NET Web Forms version, which is still commonly supported on Azure Windows Server environments for legacy applications.
✅ Steps:
- Create a Web Form named
ReadForm.aspx
.
- Use
TextBox
, Button
, and Label
controls.
- Handle form logic in
ReadForm.aspx.cs
(code-behind).
✅ `ReadForm.aspx`
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReadForm.aspx.cs" Inherits="YourNamespace.ReadForm" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Module 3 - Exercise 5 Solution</title>
</head>
<body>
<form id="frmWelcome" runat="server">
<div style="text-align: center;">
<p><strong><span style="font-size: 18pt;">Module 3 - Exercise 5 Solution</span></strong></p>
<asp:TextBox ID="txtName" runat="server" Width="300px" />
<br /><br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
<br /><br />
<asp:Label ID="lblResult" runat="server" Font-Size="Large" />
</div>
</form>
</body>
</html>
✅ `ReadForm.aspx.cs` (code-behind)
using System;
namespace YourNamespace
{
public partial class ReadForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string name = txtName.Text;
lblResult.Text = "Welcome " + Server.HtmlEncode(name) + "!";
}
}
}
✅ Notes:
- This version is written for ASP.NET Web Forms (.NET Framework), ideal for hosting on Azure App Service (Windows).
- Ensure your Azure App is set up with a proper deployment (e.g., via Visual Studio or Azure DevOps).
- Replace
"YourNamespace"
with your actual namespace.