There are some important things of note about ASP.NET. You will need Windows hosting service, and you'll need to download Visual Studio 2010 Express.
This is a very basic example. Of course, most of this would be on the Master Page (a template like a more powerful version of Dreamweaver's .dwt template files).
default.aspx
HTML Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<!-- Start Meta Block -->
<meta content="text/html; charset=iso-8859-1" http-equiv="content-type" />
<meta content="Login View Example" name="description" />
<meta content="login, view, example" name="keywords" />
<meta content="all,index,follow" name="robots" />
<meta content="noodp" name="msnbot" />
<meta content="global" name="distribution" />
<!-- End Meta Block-->
<title>Login View Example</title>
</head>
<body>
<form id="pageForm" runat="server">
<div id="siteWide">
<div id="header_wrapper">
<div id="logo">
<img src="mylogo.png" title="Login View Example" alt="Login View Example" />
</div>
<div id="navMenu">
<ul id="mainMenu">
<li>
<asp:HyperLink runat="server" ID="homeLink" NavigateUrl="~/default.aspx" AccessKey="1">Home</asp:HyperLink></li>
<li>
<asp:HyperLink runat="server" ID="aboutLink" NavigateUrl="~/about/default.aspx" AccessKey="2">About</asp:HyperLink></li>
<li>
<asp:HyperLink runat="server" ID="contactLink" NavigateUrl="~/contact/default.aspx"
AccessKey="3">Contact</asp:HyperLink></li>
<asp:LoginView ID="livNavMenu" runat="server">
<LoggedInTemplate>
<li>
<asp:HyperLink runat="server" ID="accountLink" NavigateUrl="~/profile/default.aspx"
AccessKey="4">My Account</asp:HyperLink></li>
</LoggedInTemplate>
</asp:LoginView>
</ul>
</div>
<div id="loginPanel">
<asp:LoginView ID="livLogin" runat="server">
<AnonymousTemplate>
<asp:Login ID="loginBox" runat="server" DestinationPageUrl="~/default.aspx">
</asp:Login>
</AnonymousTemplate>
<LoggedInTemplate>
<span>Welcome,
<asp:LoginName ID="userName" runat="server" />
</span>
</LoggedInTemplate>
</asp:LoginView>
</div>
</div>
<div id="content_wrapper">
<asp:LoginView ID="contentPanel" runat="server">
<AnonymousTemplate>
<div class="center emphasis">
<p>
Welcome, Guest. This site requires you to log in to continue browsing.</p>
<p>
Please login or register a new account.</p>
</div>
</AnonymousTemplate>
<LoggedInTemplate>
<div class="mainContent">
<p>
<asp:LoginName ID="loggedInUser" runat="server" />
, welcome to my website. Thank you for making an account with us. You can now explore
our full range of products and services.
</p>
</div>
</LoggedInTemplate>
</asp:LoginView>
</div>
</div>
</form>
</body>
</html>
Learning ASP.NET is a daunting task and can take a long time to master. I still find it far easier than PHP to use though and some of the features in Visual Studio make it much easier. There is seamless intellisense for Javascript, HTML and VB/C#; drag and drop "toolbox" style HTML elements and Widgets, code snippets, and code blocks; Ctrl + K, Ctrl + D keyboard shortcut for code tidying (this becomes second nature to use and it's annoying it's not a feature in all IDE's).
All this said however, ASP.NET seems to be shunned by the majority of WebDevs. I think, although I may be wrong, there is still a lot of stigma about using Microsoft products. There are not many options online for free Windows Hosting, I still have yet to find a useable host.
----------
There are two other options: PHP is the most standard, although the methods for producing the same in PHP would not be a simple two minute write up like the one above. The language is a lot more convoluted than ASP.NET in my experience and assumes a much higher prior knowledge of coding practice.
SSI is the other option, which is mainly used by Dreamweaver to create their equivalent to Master Pages. This is, again, very convoluted in it's use and doesn't offer an amazing amount of flexibility.
Unless you're hosting your own site, if you want simple coding which is hard to host, use ASP.NET. If you want difficult coding that is easy to host, use PHP. If you are hosting your own site then you can install IIS from the Windows Features section of Add/Remove Programs in Control Panel. Once that's installed just run through the My First Website tutorial for setting up your first ASP.NET website.
Bookmarks