Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
<use content="page-title"/>
</title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
<if condition="Request.IsAuthenticated">
Welcome <b> ${ Context.User.Identity.Name }</b>!
[ !{ Html.ActionLink("Log Off","LogOff", "Account") } ]
</if>
<else>
[ !{ Html.ActionLink("Log On","LogOn","Account") } ]
</else>
<span class="Apple-style-span" style="font-family: Arial, Verdana, sans-serif; white-space: normal; ">Now lets edit Index.aspx and BookList.aspx change both extensions to .spark and edit as follows: Index.spark</span>
<content name="page-title">
Home Page
</content>
<content name="main-content">
<h2>${ ViewData["Message"] }</h2>
<p>
To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
</p>
</content>
<viewdata model="IEnumerable<Book>" />
<content name="page-title">
BookList
</content>
<content name="main-content">
<h2>BookList</h2>
<div each="var book in Model">
Book Id: ${ book.Id } <br />
<viewdata model="ChangePasswordModel" PasswordLength="int" />
<use master="" />
<content name="page-title">
Change Password
</content>
<content name="main-content">
<h2>Change Password</h2>
<p>
Use the form below to change your password.
<use master="" />
<content name="page-title">
Change Password
</content>
<content name="main-content">
<h2>Change Password</h2>
<p>
Your password has been changed successfully.
<viewdata model="LogOnModel" />
<use master="" />
<content name="page-title">
Register
</content>
<content name="main-content">
<h2>Log On</h2>
<viewdata model="RegisterModel" PasswordLength="int" />
<use master="" />
<content name="page-title">
Register
</content>
<content name="main-content">
<h2>Create a New Account</h2>
public static class AccountValidation
{
public static string ErrorCodeToString(MembershipCreateStatus createStatus)
{
// See http://go.microsoft.com/fwlink/?LinkID=177550 for
// a full list of status codes.
switch (createStatus)
{
case MembershipCreateStatus.DuplicateUserName:
return "Username already exists. Please enter a different user name.";
public sealed class PropertiesMustMatchAttribute : ValidationAttribute
{
private const string _defaultErrorMessage = "'{0}' and '{1}' do not match.";
private readonly object _typeId = new object();
public PropertiesMustMatchAttribute(string originalProperty, string confirmProperty)
: base(_defaultErrorMessage)
{
OriginalProperty = originalProperty;
ConfirmProperty = confirmProperty;