Search code examples
javascriptasp.netserver-side

Short ASP.NET Date Program


I keep getting a runtime error but my schools servers doesn't like to print out errors. I copied this straight from the book and I've checked it quite a few times - it looks right to me. Am I missing something here? It just tells me runtime error

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>A Simple ASP.NET Example</title>
    <style type="text/css">
        td{background-color:black;color:yellow;}
        strong{font-family:arial, sans-serif;}
        p{font-size:14pt}
    </style>
    <script runat="server" langauge="JScript">
        var dayAndTime : DateTime = DateTime.Now;
    </script>
</head>
<body>
    <strong>A Simple ASP.NET Example</strong>
    <p>
        <table border="6">
            <tr>
                <td>
                    <% Response.Write(dayAndTime.ToShortTimeString()); %>
                </td>
                <td>
                    <% Response.Write(dayAndTime.ToShortDateString()); %>
                </td>
            </tr>
        </table>
    </p>
</body>
</html>

Solution

  • Since you cannot determine exactly what is causing the error and you only have 3 lines of .net, try taking them out one at a time until the program runs. This will tell you what line is at least causing the problem. Start with the response.write :p