The key difference between developing MCMS applications with Visual Studio .NET 2003 and Visual Studio 2005 is that ASP.NET applications (and therefore MCMS applications) are now built using the Visual Web Developer component of Visual Studio 2005. Visual Web Developer introduces a new “project system”, which no longer uses the project (*.csproj) files and simply accesses web applications via HTTP or the file system.
In Visual Studio .NET 2003, MCMS applications were created by choosing the MCMS Web Application project type. This project type was effectively a regular ASP.NET web application project with some modifications required by MCMS, such as additional references, the web authoring console, and modifications to the web.config. In Visual Studio 2005, developing web applications has been separated from developing other project types. The feature to develop a web application has been moved into the Visual Web Developer component.
To reflect this design change, you are no longer using New Project but New Web Site from the File menu in Visual Studio 2005 to create a new website.
Visual Studio 2005 ships with several website templates. The installation of the developer tools for MCMS extends the list of website templates with three additional templates: MCMS Empty Web Project, MCMS Web Application, and MCMS Web Service. These templates are actually modified versions of the similarly named standard templates shipped with Visual Studio 2005.
Let’s create an MCMS web application using Visual Studio 2005.
If the MCMS Web Application template does not appear in the My Templates section, the MCMS Visual Studio 2005 templates have not been correctly installed. Please refer to the Visual Studio Templates section of Article 1 for installation details.
MCMS applications have to be created using a local installation of IIS and do not support being created using the file system, which makes use of the built-in Visual Web Developer Web Server.
Note that the New Web Site wizard will not prevent you from configuring an invalid website using the File System and Visual Web Developer Web Server.
If you wish, you can also choose VB.NET. The samples in this article series are all written in Visual C#.
The MCMS Template Explorer within Visual Studio 2005 logs on to the MCMS repository using the credentials of the currently logged-on user. If this operation fails, check your MCMS Rights Groups configuration. The Template Explorer does not allow you to specify alternative credentials.
If you don’t see the Template Explorer, it is likely you didn’t select HTTP in the Location combo box in step 4. You may also not see the Template Explorer if you are using a locale other than US English, in which case you need to install hotfix 914195 as detailed in Article 1.
We can verify that Visual Studio 2005 has configured the MCMS application correctly by using the Internet Information Services snap-in. First, let’s ensure that the mcmstest website is indeed running on ASP.NET 2.0.
When developing on Windows Server 2003, the Virtual Website root must run in the same worker process (that is Application Pool) as all MCMS applications so that the MCMS ISAPI Filter can work as expected. This filter cannot route requests across worker-process boundaries. In effect this means that all MCMS applications will share the same ASP.NET version, as ASP.NET does not support side-by-side execution of different versions inside the same worker process. This is not necessary with IIS on Windows XP as it does not use Worker Process Isolation mode.
Next, we will check the authentication settings. For now, we will configure the website to use integrated Windows authentication. Only users with a domain or local user account will have access to the site. Later in Article 6 we will show alternative authentication methods such as Forms Authentication.
Note that we configured the Virtual Web Site to use Windows authentication in Article 1. Authentication methods can be configured on a per-application basis.
We are now ready to get started on developing our ASP.NET 2.0-based MCMS applications. There are a number of quirks with the MCMS web application templates, which we need to bear in mind during development.
Notice that the Basic.aspx file has a few problems. Some elements are highlighted by IntelliSense “squiggles”, and if we attempt to build the website, a number of errors will prevent a successful build. Let’s correct the Basic.aspx template file.
The MCMS Web Application New Item template doesn’t recognize that our new template file has been created in a subdirectory, and therefore the CodeFile attribute is incorrect. New templates in the web root are not affected.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
The comments within an inline ASP script block (<% %>) are unnecessary.
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 8.0">
<meta name="CODE_LANGUAGE" content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
These <meta> tags are unnecessary.
<%@ Register TagPrefix="cms" Namespace="Microsoft
ContentManagement.WebControls" Assembly="Microsoft.
ContentManagement.WebControls"%>
with
<%@ Register Assembly="Microsoft.ContentManagement.WebControls,
Version=5.0.1200.0, Culture=neutral, PublicKeyToken=31bf385
6ad364e35" Namespace="Microsoft.ContentManagement.WebControls"
TagPrefix="cms"%>
The original Register directive is not correctly recognized by Visual Studio 2005, and prevents IntelliSense from including the cms tag prefix.
<%@ Page language="c#" AutoEventWireup="false" CodeFile="Basic.
aspx.cs" Inherits="Basic.Basic"%>
<%@ Register Assembly="Microsoft.ContentManagement.WebControls,
Version=5.0.1200.0, Culture=neutral, PublicKeyToken=
31bf3856ad364e35"
Namespace="Microsoft.ContentManagement.WebControls"
TagPrefix="cms"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<title>Basic</title>
<cms:RobotMetaTag runat="server"></cms:RobotMetaTag>
</head>
<body>
<form id="Form1" method="post" runat="server">
</form>
</body>
</html>
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…