Jump to content

ASP web page.


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...