📄 aspnet_pages.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASP.NET Web Pages</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>ASP.NET - Web Pages</h1>
<a href="aspnet_install.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" /></a>
<a href="aspnet_controls.asp"><img alt="next" border="0" src="../images/btn_next.gif" /></a>
<hr />
<p class="intro">A simple ASP.NET page looks just like an ordinary HTML page.</p>
<hr />
<h2>Hello W3Schools</h2>
<p>To start learning ASP.NET, we will construct a very simple HTML page
that will display "Hello W3Schools" in an Internet browser like this:</p>
<table bgcolor="yellow" border="1" width="100%">
<tr>
<td align="center">
<h2>Hello W3Schools!</h2>
<p> </p>
<p> </p>
</td>
</tr>
</table>
<br />
<hr />
<h2>Hello W3Schools in HTML</h2>
<p>This code displays the example as an HTML page:</p>
<table class="ex" border="1" width="100%">
<tr><td>
<pre><html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html></pre></td></tr>
</table>
<p>If you want to try it yourself, save the code in a file called "<b>firstpage.htm</b>", and create a
link to the file like this:
<a target="_blank" href="firstpage.htm">firstpage.htm</a></p>
<hr />
<h2>Hello W3Schools in ASP.NET</h2>
<p>The simplest way to convert an HTML page into an ASP.NET page is to
copy the HTML file to a new file with an <b>.aspx</b> extension.</p>
<p>This code displays our example as an ASP.NET page:</p>
<table class="ex" border="1" width="100%">
<tr><td>
<pre><html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
</center>
</body>
</html></pre></td></tr>
</table>
<p>If you want to try it yourself, save the code in a file called "<b>firstpage.aspx</b>", and
create a link to the file like
this: <a target="_blank" href="firstpage.aspx">firstpage.aspx</a></p>
<hr />
<h2>How Does it Work?</h2>
<p>Fundamentally an ASP.NET page is just the same as an HTML page.</p>
<p>An HTML page has the extension .htm. If a browser requests an HTML page from the server,
the server sends the page to the browser without any modifications.</p>
<p>An ASP.NET page has the extension .aspx. If a browser requests an ASP.NET
page, the server processes any executable code in the page, before the result is
sent back to the browser.</p>
<p>The ASP.NET page above does not contain any executable code,
so nothing is executed. In the next examples we will add some executable code to
the page to demonstrate the difference between static HTML pages and dynamic ASP pages. </p>
<hr />
<h2>Classic ASP</h2>
<p>Active Server Pages (ASP) has been around for several years. With ASP,
executable code can be placed inside HTML pages.</p>
<p>Previous versions of ASP (before ASP .NET) are often called Classic ASP.</p>
<p>ASP.NET is not fully compatible with Classic ASP, but most Classic ASP pages
will work fine as ASP.NET pages, with only minor changes.</p>
<p>If you want to learn more about Classic ASP, please visit our
<a href="../asp/default.asp">ASP Tutorial</a>.</p>
<hr />
<h2>Dynamic Page in Classic ASP</h2>
<p>To demonstrate how ASP can display pages with dynamic content, we have added
some executable code (in red) to the previous example:</p>
<table class="ex" border="1" width="100%">
<tr><td>
<pre><html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
<p><span style="color: #FF0000"><%Response.Write(now())%></span></p>
</center>
</body>
</html></pre></td></tr>
</table>
<p>The code inside the <% --%> tags is executed on the server.</p>
<p>Response.Write is ASP code for writing something to the HTML output stream.</p>
<p>Now() is a function returning the servers current date and time.</p>
<p>If you want to try it yourself, save the code in a file called "<b>dynpage.asp</b>", and
create a link to the file like
this: <a target="_blank" href="dynpage.asp">dynpage.asp</a></p>
<hr />
<h2>Dynamic Page in ASP .NET</h2>
<p>This following code displays our example as
an ASP.NET page:</p>
<table class="ex" border="1" width="100%">
<tr><td>
<pre><html>
<body bgcolor="yellow">
<center>
<h2>Hello W3Schools!</h2>
<p><span style="color: #FF0000"><%Response.Write(now())%></span></p>
</center>
</body>
</html></pre></td></tr>
</table>
<p>If you want to try it yourself, save the code in a file called "<b>dynpage.aspx</b>", and
create a link to the file like
this: <a target="_blank" href="dynpage.aspx">dynpage.aspx</a></p>
<hr />
<h2>ASP.NET vs Classic ASP</h2>
<p>The previous examples didn't demonstrate any differences between ASP.NET and
Classic ASP.</p>
<p>As you can see from the two latest examples there are no differences between the two ASP
and ASP.NET pages.</p>
<p>In the next chapters you will see how server controls make ASP.NET more
powerful than Classic ASP. </p>
<hr />
<a href="aspnet_install.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" /></a>
<a href="aspnet_controls.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -