ASP.NET Test Page

You can use the following code in a test.aspx file to check and see if asp.net is working on your account

<%@ Page Language="VB" %>
<script language="VB" runat="server">

' There are a lot of different ways to do this so I'm going
' to show you a couple of them all in this one sample.
' That way you can choose whichever method works best for
' your particular situation.

Sub Page_Load(sender as Object, e as EventArgs)
Dim I As Integer


' Method 2 coding
Dim strText

For I = 1 To 5
strText = strText & "<font size=""" & I & """>Hello World</font><br />" & vbCrLf
Next I
lblHelloWorld2.Text = strText


' Method 3 coding
Dim myStringBuilder As New StringBuilder

For I = 1 To 5
myStringBuilder.Append("<font size=""" & I & """>Hello World</font><br />" & vbCrLf)
Next I
lblHelloWorld3.Text = myStringBuilder.ToString


' Method 4 coding
Dim lblMessage as Label
For I = 1 To 5
lblMessage = New Label()
lblMessage.Text = "<font size=""" & I & """>Hello World</font><br />" & vbCrLf
' Conflicts with method 1 - remove inline <% %>
' coding and then uncomment this line.
'Controls.Add(lblMessage)
Next I
End Sub

</script>

<html>
<head>
<title>ASP.NET Hello World Sample</title>
</head>
<body>

<h2>Method 1 - just like &quot;classic ASP&quot;</h2>

<%
' Loop from 1 to 5 incrementing font size.
Dim I
For I = 1 To 5
Response.Write("<font size=""" & I & """>Hello World</font><br />" & vbCrLf)
Next I
%>

<hr />

<h2>Method 2 - String Concatenation</h2>

<asp:Label id="lblHelloWorld2" runat="server" />

<hr />

<h2>Method 3 - StringBuilder</h2>

<asp:Label id="lblHelloWorld3" runat="server" />

<hr />

<h2>Method 4 - Dynamic Server Controls</h2>

<p>
Conflicts with method 1 - remove inline &lt;% %&gt;
coding and then uncomment the indicated line in the
Page_Load sub to play with this method.
</p>

</body>
</html>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Access error messages

#1 : Cannot update. Database or object is read-only Microsoft OLE DB Provider for ODBC Drivers...

Active Server Pages error ASP 0131 or Server.MapPath() error 'ASP 0175 : 80004005'

SYMPTOMS:When you use relative paths in include statements with Microsoft's Active Server Pages...

Access Plesk Panel

Plesk Panel Access: To log in to the Plesk interface, perform the following steps: Enter the...