Jump to content

ASP web page.


Rewillis

Recommended Posts

Attention: w3schools.com staff:

     I have copied the following code directly from the w3schools.com web site, regarding an ASP example:

<!DOCTYPE html>

<html lang="en">
<head>
     <meta charset="utf-8" />
     <title>Web Pages Demo</title>
</head>
<body>
     <h1>Hello Web Pages</h1>
     <p>The time is @DateTime.Now</p>
</body>
</html>

However, when I serve it up to my IIS 10 web server, the current date and time is not sent to my web browser.  Instead, I get the following output:

"Hello Web Pages"

"The time is @DateTime.Now"

I have saved my web page with the ".htm," ".aspx," and ".asp" file types, but I get the same result as described above.  Why is the current date and time not being sent to my web browser?

Link to comment
Share on other sites

Hi @Rewillis

You've missed out one character! Make sure you have the = character after the first % sign so that the @DateTime.Now is outputted rather than only being evaluated.

<p>The time is <%= @DateTime.Now %></p>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...