I have just purchased Beginning ASP.NET 1.0 with C# by Wrox Press. And have fallen at the first hurdle, which is I can't get the test program to work. I have made sure it's saved as .aspx file yet all it does is display the HTML and on viewing the page source in the browser I can still see the script itself.
The code I was required to type word for word was as follows:
<script language="c#" runat="server">
void Page_Load()
{
time.text=DateTime.Now.Hour.ToString() + ":" +
DateTime.Now.Minute.ToString() + ":" +
DateTime.Now.Second.ToString();
}
<html>
<head><title>The Punctual Web Server</title></head>
<body>
<h1>Welcome</h1>
In WebServerLand the time is currently:
<asp:label id="time" runat="server" />
</body>
</html>
Being new to ASP.NET this code seems wrong as shouldn't any ASP code still be embedded using <% and %> and shouldn't all ASP.NET pages have the following header:
<%@Page Language"C#" runat="server">
I have .NET frame work and am running the scripts on my own machine but it just does work ! I have tried a script using
VB.NET and classic ASP and that works fine. Any ideas ? is the code presented in book correct? am I doing something wrong?
I am using MS Windows XP Professional and have IIS 5.1 installed and have tested scripts on my machine using a localhost
Gaz