WLW Manifest file

wlwmanifest.xml is very important




is enough to say I don’t support categories.








if you add these following line you will get ”

mt.setPostCategories MVC HtmlHelper and UrlHelper

<% using (Html.BeginForm()) { %>

<% using (Html.BeginForm()) { %>


HtmlHelper class vs. UrlHelper class

HtmlHelper is to emit out entire html tags, like Html.BeginForm() will output something like

<form action="/blog/setting/password" method="post">

Whereas UrlHelper will only output an url,

Both can be extended using Extension Methods, for example I created my own class UrlHelperExtension,

public static class UrlHelperExtension
public static string Home(this UrlHelper helper)
return helper.Content("~/");

When using it you can,

<a href="<%= Url.BlogHome() %>">Blog</a>



When you don’t specify anything in the BeginForm,

<% using (Html.BeginForm()) { %>


the action attribute will have value of whatever path this .aspx page’s url has

<form action="/blog/setting/password" method="post">


Alternatively, you can do

<form id="changePasswordForm" action="<%= Url.Action("ChangePassword", "Account") %>" method="post">


Define URL Flow

1. Global.asax
routes.MapRoute("SettingGeneral", "setting/general", 
new { controller = "Default", action = "SettingGeneral" });

2. UrlExtensions.cs

public static string SettingGeneral(this UrlHelper helper)
return helper.RouteUrl("SettingGeneral");

3. The view: aspx, ascx

<a href="<%= Url.SettingGeneral() %>">Setting</a><br />

Restore my production SQL Server database

Today I restore a .bak file from my web host that contains my production data to my local SQL Server 2008.

Right click on “Databases –> Restore Database…” would bring up the following,

Restore database

Since I don’t have an existing database to restore this .bak to, I put a new name “Personality.Prod”.

Choose “From device:” and locate the .bak file and check mark it and click OK.

The new .mdf and .ldf will be saved in your default database folder.

Authentication in ASP.NET MVC


Q: What controls to show the Login page when you access a authorized-required resource in an MVC application?

A: The web.config

   1: <authentication mode="Forms">

   2:     <forms loginUrl="~/Account/LogOn" timeout="2880" />

   3: </authentication>


For example in your AccountController you have the following.

   1: [Authorize]

   2: public ActionResult ChangePassword()

   3: {

   4:     return View();

   5: }

The [Authorize] attribute says authentication is required when you want to change your password, but it doesn’t specify where to direct you to for the authentication.

How to develop with Disqus on localhost

I assume you already have an account on

1. Setup your site on  This is your live site, don’t create localhost as a site there.

2. Follow instructions and copy paste the snippets into your pages.

3. Run your app at your local using FireFox (IE8 for some reason didn’t show this message), and it’ll show that it didn’t work correctly and asks your to go visit

4. On this page you’ll learn that you need to insert the following snippet into your <head>. 

   1: <script type="text/javascript">


   3:     var disqus_developer = 1; // this would set it to developer mode


   5: </script> 

5. Finally just test everything out by posting some comments, everything should work now.