Archives

Archives / 2005 / March
  • Customize Template in Web Matrix

    Unlike Visual Studio .NET, ASP.NET Web Matrix will only generate a very simple code file when creating a new web form. However, we can customize the template as in Visual Studio .NET, and the template file for Web Matrix is normally located at:

    [InstallationFolder]\[VersionNumber]\WebMatrix\Templates\aspx\[LanguageType], for example: C:\Program Files\Microsoft ASP.NET Web Matrix\v0.6.812\WebMatrix\Templates\aspx\C#

    A sample modified template like:

       1:  <%@ Page Language="C#" %>
       2:  <script runat="server">
       3:   
       4:      // Insert page code here
       5:      //
       6:   
       7:  </script>
       8:  <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
       9:  <html>
      10:  <head>
      11:      <title></title> 
      12:      <meta content="..." name="..." />
      13:  </head>
      14:  <body>
      15:      <form runat="server">
      16:          <!-- Insert content here -->
      17:      </form>
      18:  </body>
      19:  </html>


    Finally, we would see a new element of <title></title> and DOCTYPE tag in that ASPX file, and we can also do the same for different types of files such as ASCX, ASMX..etc