ASP.NET MVC Preview 2 and ASP.NET Server Controls for Silverlight

This document provides information about the following releases in March 2008 ("new releases"):

  • Silverlight Tools Beta 1 for Visual Studio 2008. This release includes the Silverlight 2 SDK Beta 1 ("the SDK"), in addition to templates and other tools for Visual Studio 2008. The SDK contains a revision of the ASP.NET server controls for Silverlight (MediaPlayer and Silverlight). To install these features, go to the Silverlight Downloads Page and install Silverlight Tools Beta1 for Visual Studio 2008.
  • ASP.NET MVC Preview 2. This release contains the latest revision of the Model-View-Controller framework for ASP.NET. This release is available on the Microsoft Download site.

This document is intended for you if you want to use the ASP.NET server controls for Silverlight or the MVC framework shipped in the releases listed above. The document describes the known issues, and it provides information for developers who are using these releases in conjunction with features from the following releases ("previous releases"):

  • ASP.NET 3.5 Extensions Preview (released December 2007). This release was an earlier Community Technology Preview (CTP) that included the ASP.NET MVC features and ASP.NET server controls for Silverlight under the names MediaPlayer and Silverlight.
  • ASP.NET Futures (July 2007). This release contained early prototypes of the ASP.NET server controls for Silverlight under the names Media and Xaml.

Note for Users of Visual Web Developer 2008 Express Edition

The new releases provide Visual Studio templates that are not supported in Visual Web Developer 2008 Express Edition. For example, you cannot create an MVC application or Silverlight .xap files by using Visual Web Developer 2008 Express Edition. However, if you are using Visual Web Developer, you can download the Silverlight 2 SDK Beta 1 separately and use the ASP.NET server controls for Silverlight in your ASP.NET Web applications. To install the SDK, go to the Silverlight Downloads Page and follow the links on that page.

The information in this document that describes ASP.NET MVC, or that describes Visual Studio project templates, does not apply if you are using Visual Web Developer 2008 Express Edition and if you install the SDK alone. Information in this document about changes to ASP.NET server controls for Silverlight does apply.


Contents

Note for Users of Visual Web Developer 2008 Express Edition

Contents

Background

ASP.NET 3.5 Extensions Preview

ASP.NET Futures (July 2007)

The New Releases

Using Features from the Previous and New Releases

Creating Web Applications with the ASP.NET MVC Preview 2 Release

Creating Web Applications with the ASP.NET Server Controls for Silverlight

Using the ADO.NET Entity Framework or ADO.NET Data Services

Upgrading Web Sites or Applications from the ASP.NET 3.5 Extensions Preview Release

General Steps

Removing Dynamic Data

Removing MVC and Dynamic Data Modules and Handlers

Upgrading an MVC Web Application

Upgrading an ASP.NET Web Application that Uses ASP.NET Controls for Silverlight

API Changes and Breaking Changes from the ASP.NET 3.5 Extensions Preview Release

ASP.NET MVC

Routes

Controller

Action Filters

Extensibility

Visual Studio

ASP.NET Server Controls for Silverlight

Server API Changes

Client API Changes

Known Issues in the New Releases

ASP.NET MVC


Background for Previous Releases

This section describes releases that contain functionality that has been updated in the new releases.

ASP.NET 3.5 Extensions Preview

ASP.NET shipped new functionality in the ASP.NET 3.5 Extensions Preview as a CTP in December 2007. The following table lists the features in that release.

Note   The ASP.NET 3.5 Extensions Preview readme provides information about using the ASP.NET 3.5 Extensions Preview release with the earlier ASP.NET Futures (July 2007) release.

Feature

Description

ASP.NET MVC framework A framework for implementing the model-view-controller (MVC) pattern for ASP.NET Web applications.
ASP.NET Dynamic Data Scaffolding and templates that let you quickly and easily generate a data-driven Web site.
ASP.NET AJAX AJAX support for managing browser history in both client and server code.
ASP.NET server controls for Silverlight Controls that provide Silverlight functionality in your ASP.NET applications by using the familiar server-control model.
ADO.NET Entity Framework A modeling framework that enables you to define a conceptual model of a database schema that closely aligns to a real-world view of the information. Benefits include application code that is easier to understand and easier to maintain, which is also shielded from underlying database schema changes.
ADO.NET Data Services (code-name "Astoria") Provides new services that find, manipulate, and deliver data over the Web using simple URLs. Benefits include an easy and flexible way to access data over the Web, while enabling the separation of presentation and data access code.

 

Many of the features in this release are defined in an update to the System.Web.Extensions (3.6.0.0) assembly that is installed into the global assembly cache (GAC). The installation process also creates the Visual Studio templates that are listed in the following table.

Feature

Visual Studio items added during installation

ASP.NET MVC framework ASP.NET MVC Web Application project template
ASP.NET MVC Web Application and Test project template
ASP.NET Dynamic Data, ASP.NET AJAX
ASP.NET server controls for Silverlight
ASP.NET 3.5 Extensions Web Site project template
ASP.NET 3.5 Extensions Web Application project template.
ADO.NET Entity Framework ADO.NET Entity Data Model item template
ADO.NET Data Services ADO.NET Data Services item template

 

All server controls are in the ASP.NET 3.5 Extensions tab in the Visual Studio Toolbox. These controls represent the suite in the System.Web.Extensions 3.6.0.0 assembly. Controls are updated and filtered in the Visual Studio Toolbox depending on the type of project you are working with.

ASP.NET Futures (July 2007)

ASP.NET shipped functionality in the ASP.NET Futures (July 2007) as a CTP. The following table lists the feature areas from that release that are covered by the information in this readme.

Feature

Description

ASP.NET Dynamic Data An earlier release of Dynamic Data controls.
ASP.NET AJAX An earlier release of AJAX support for managing the browser history as a server control called History and a client-side type
ASP.NET server controls for Silverlight An earlier release of ASP.NET server controls for Silverlight, named Xaml and Media.

 

The features listed in the previous table are in the Microsoft.Web.Extensions assembly. The installation process also creates the Visual Studio "ASP.NET Futures (July 2007) Web application" project templates. Also, all server controls are in the ASP.NET 3.5 Extensions tab in the Visual Studio Toolbox.

The New Releases

The following table briefly describes the features that are in the ASP.NET MVC Preview 2 and Silverlight 2 SDK Beta 1 releases.

Feature

Release

Visual Studio Items

Assembly

ASP.NET server controls for Silverlight. Silverlight Tools Beta 1 for Visual Studio 2008. The Silverlight Tools Beta 1 for Visual Studio 2008 installation process creates Toolbox items in Visual Studio for the Silverlight and MediaPlayer controls in the Silverlight tab. System.Web.Silverlight
ASP.NET MVC ASP.NET MVC Preview 2. ASP.NET MVC Web Application project template and item templates. System.Web.Mvc, System.Web.Abstractions, System.Web.Routing

 

When you install Silverlight Tools Beta 1 for Visual Studio 2008, the installation process puts the System.Web.Silverlight assembly in the following location:

%WINDIR%\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server

Installing the ASP.NET MVC Preview 2 puts the System.Web.Abstractions, System.Web.Mvc, and System.Web.Routing assemblies in the following location:

%WINDIR%\Program Files\Microsoft ASP.NET MVC Preview 2\Assemblies

The installation process also removes the project templates for ASP.NET MVC Web applications that were installed for previous releases.

Using Features from the Previous and New Releases

The MVC framework and ASP.NET server controls for Silverlight are shipped both in the new releases and the previous releases. We recommend that you uninstall the previous releases before you use the new ASP.NET MVC Preview 2 release or ASP.NET server controls for Silverlight in Silverlight Tools Beta 1 for Visual Studio 2008.

However, the earlier ASP.NET 3.5 Extensions Preview release contains features that have not been updated, such as the AJAX and dynamic data features and the ADO.NET Data Services and ADO.NET Entity Framework. There are specific considerations you should make if you wish to continue to use these features and wish to test the latest features in the new releases:

  • AJAX and dynamic data features cannot be mixed in the same Web site or application as the new ASP.NET MVC. You should use separate Web sites or applications.
  • You cannot use the previous ASP.NET server controls for Silverlight in the same Web site or application as the new release, or within the new ASP.NET MVC release. You should use separate Web sites or applications.
  • You can continue to use ADO.NET Data Services or ADO.NET Entity Framework within the new ASP.NET MVC release, see section: Using the ADO.NET Entity Framework or ADO.NET Data Services.

Creating Web Applications with the ASP.NET MVC Preview 2 Release

The ASP.NET MVC Preview 2 release creates new Web application project templates, as described in The New Releases. Make sure that you use these project templates to create new ASP.NET MVC Web applications instead of using the Web application project templates that the previous release installed. For more information, see ASP.NET 3.5 Extensions Preview elsewhere in this document.

Creating Web Applications with the ASP.NET Server Controls for Silverlight by Using the Silverlight 2 SDK Beta 1 Release

The Silverlight Tools Beta 1 for Visual Studio 2008 release adds the MediaPlayer and Silverlight controls in the Silverlight tab in the Visual Studio Toolbox for regular ASP.NET Web sites or application project templates. When you drag these controls onto a page, the System.Web.Silverlight assembly is copied to the Bin folder of the application.

The ASP.NET 3.5 Extensions Preview also puts the MediaPlayer and Silverlight controls in the ASP.NET 3.5 Extensions tab in the Visual Studio Toolbox. (This tab appears only when you select a project template that is related to the ASP.NET 3.5 Extensions Preview.)

If both sets of server controls appear in the Toolbox, you are working with an older project or Visual Studio is configured incorrectly. Use only the controls in the Silverlight tab of the Toolbox. Also make sure that you follow the procedure listed under General Steps to update the configuration file. For more information about upgrading an existing ASP.NET 3.5 Extensions Preview, see the section Upgrading an ASP.NET Web Application that Uses ASP.NET Controls for Silverlight elsewhere in this document.

Using the ADO.NET Entity Framework or ADO.NET Data Services

The ADO.NET Entity Framework and ADO.NET Data Services features shipped in the previous release, as described in ASP.NET 3.5 Extensions Preview. You can use the ADO.NET Entity Framework or ADO.NET Data Services in a new ASP.NET MVC Web application or in a traditional ASP.NET Web application.

If you uninstall the ASP.NET 3.5 Extensions Preview, you can reinstall the ADO.NET Entity Framework separately from the ADO.NET Entity Framework Beta 3 page and the ADO.Net Entity Framework Tools Dec 07 Community Technology Preview page on the Microsoft Download Center.

You can use ADO.NET Data Services only by installing the ASP.NET 3.5 Extensions Preview release.


Upgrading Web Sites or Applications from the ASP.NET 3.5 Extensions Preview Release

General Steps

The following steps apply generally to any ASP.NET 3.5 Extensions Preview Web application that you are upgrading to use only the latest version of ASP.NET MVC or the latest ASP.NET server controls for Silverlight. For additional information about upgrading specific features in existing sites, see Upgrading an MVC Web Application and Upgrading an ASP.NET Web Application that Uses ASP.NET Controls for Silverlight.

1.       Open the Web.config file.

2.       Change all references from System.Web.Extensions, Version=3.6.0.0 to System.Web.Extensions, Version=3.5.0.0., as shown in the following example:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, 
  System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
  PublicKeyToken=31BF3856AD364E35"/>

3.       If the Web.config file contains references to System.Web.Extensions.Design 3.6.0.0, change the references to System.Web.Extensions.Design 3.5.0.0.

4.       Remove the following bindings section, because it is no longer required:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Extensions" 
        publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.5.0.0" 
          newVersion="3.6.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Extensions.Design" 
        publicKeyToken="31bf3856ad364e35"/>
      <bindingRedirect oldVersion="1.0.0.0-3.5.0.0" newVersion="3.6.0.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>

5.       Make sure that the <compilation><assemblies> section references System.Web.Extensions.dll and System.Web.Extensions.Design.dll 3.5.0.0, as shown in the following example

<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
  PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0,
  Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

6.       Save and close the Web.config file.

7.       If you are working with a Web Application Project, change the project reference to point from System.Web.Extensions version 3.6.0.0 to version 3.5.0.0 by following these steps:

a.       In Solution Explorer, open the References node and right-click the System.Web.Extensions assembly reference. (In the Properties window, notice that this assembly is version 3.6.0.0.)

b.      Select Remove.

c.       In Solution Explorer, right click References, and then select Add Reference.

d.      In the Add Reference dialog box, click the .NET tab.

e.      Select the System.Web.Extensions and System.Web.Extensions.Design assemblies. (Make sure that you select version 3.5.0.0.)

f.        Click OK.

Removing Dynamic Data

Use the following procedure to remove any references to ASP.NET Dynamic Data in the Web application that you are upgrading.

1.       Make sure that you have followed the procedure described in the General Steps section.

2.       Open the Web.config file.

3.       Remove the following entry in the <pages><controls> section that maps the asp: tag prefix to the System.Web.DynamicData namespace:

<add tagPrefix="asp" namespace="System.Web.DynamicData"
  assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

4.       Remove the following entry in the <pages><controls> section that maps the asp: tag prefix to the DynamicFilter tag name:

<add tagPrefix="asp"  tagName="~/App_Shared/DynamicDataFields/FilterUserControl.ascx"/>

5.       Remove the following entry in the <configuration><configSections> section that adds the dynamicData section handler:

<section name="dynamicData" type="System.Web.DynamicData.DynamicDataControlsSection"
  requirePermission="false" allowDefinition="MachineToApplication" />

6.       Remove the following entry in the <httpModules> section that adds the DynamicDataModule type.

Note   The reference to 3.5.0.0 in this section is the result of changing references as described in General Steps.

<add name="DynamicDataModule" type="System.Web.DynamicData.DynamicDataHttpModule,
    System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 

7.       Remove the following dynamic data section under <system.web.extensions>:

<dynamicData dataContextType="" enableTemplates="false">
  <mappings queryStringKeyPrefix="" pattern="~/{table}/{viewName}.aspx">
    <add actions="list,details" viewName="ListDetails"
      templateFile="ListDetailsTemplate.aspx"/>

 <!--
   <add actions="list" viewName="List" templateFile="ListTemplate.aspx" />
   <add actions="details" viewName="Details" 
     templateFile="DetailsTemplate.aspx" />
 -->

 <!--
   Special overriding cases
   <add actions="list,details" tables="Products,Categories" 
     viewName="SpecialName" templateFile="ListTemplate.aspx"/>
   <add actions="list" tables="Products" 
     templateFile="DetailsTemplate.aspx" path="~/customPath.aspx"/>

   <add actions="list" tables="Orders" viewName="MyListViewName"/>
  
-->

</mappings>
</dynamicData>

8.       Save and close the Web.config file.

Removing MVC and Dynamic Data Modules and Handlers

You might need to remove references to ASP.NET Dynamic Data and the ASP.NET 3.5 Extensions Preview MVC handlers and modules in the Web application that you are upgrading. Follow these steps:

1.       Make sure that you have followed the procedure described in the General Steps section.

2.       Open the Web.config file.

3.       Update the <system.webServer> section to reflect the following example.

<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">
     <remove name="ScriptModule" />
      <add name="ScriptModule" preCondition="managedHandler" 
        type="System.Web.Handlers.ScriptModule, System.Web.Extensions, 
        Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>

    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory" />
      <remove name="ScriptHandlerFactoryAppServices" />
      <remove name="ScriptResource" />
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx"  preCondition="integratedMode"
         type="System.Web.Script.Services.ScriptHandlerFactory, 
           System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
           PublicKeyToken=31BF3856AD364E35"/>

      <add name="ScriptHandlerFactoryAppServices" verb="*" 
         path="*_AppService.axd" preCondition="integratedMode"
         type="System.Web.Script.Services.ScriptHandlerFactory, 
           System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
           PublicKeyToken=31BF3856AD364E35"/>

      <add name="ScriptResource" preCondition="integratedMode" 
         verb="GET,HEAD" path="ScriptResource.axd"  
         type="System.Web.Handlers.ScriptResourceHandler,
           System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
           PublicKeyToken=31BF3856AD364E35" />
    </handlers>
</system.webServer>

4.       Remove the following entry in the <httpModules> section that adds the UrlRoutingModule type.

Note   The reference to 3.5.0.0 in this section is the result of changing references as described in General Steps.

<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,
  System.Web.Routing, Version=3.5.0.0, Culture=neutral,
  PublicKeyToken=31BF3856AD364E35" />

5.       Save and close the Web.config file.

Upgrading an MVC Web Application

If you are upgrading from a Web application that was created using the ASP.NET 3.5 Extensions Preview, follow these steps.

Note    These steps do not describe the code changes that might be necessary to change existing code to fix compilation errors that occur due to API changes and breaking changes.

1.       Make sure that you have followed the procedure described in the General Steps section.

2.       Open the Web.config file.

3.       Remove the following entry in the <pages><controls> section that maps the asp: tag prefix to the System.Web.UI.SilverlightControls namespace:

<add tagPrefix="asp" namespace="System.Web.UI.SilverlightControls"
  assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
  PublicKeyToken=31BF3856AD364E35"/>

4.       Add the following entries in the <assemblies> section for the System.Web.Abstractions, System.Web.Mvc, and System.Web.Routing assemblies:

<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral,
  PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral,
  PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral,
  PublicKeyToken=31BF3856AD364E35"/>

5.       In the <pages> section, add the following element in the <namespaces> section:

<add namespace="System.Web.Routing"/>

6.       Add the following entry in the <httpModules> section for the UrlRoutingModule type:

<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,
  System.Web.Routing, Version=3.5.0.0, Culture=neutral,
  PublicKeyToken=31BF3856AD364E35" />

7.       Update the <system.webServer> section to include the UrlRoutingModule type, UrlRoutingHandler type, and the MVC script maps, so that the resulting section looks like the following example:

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ScriptModule" />
      <remove name="UrlRoutingModule" />
      <add name="ScriptModule" preCondition="managedHandler" 
        type="System.Web.Handlers.ScriptModule, System.Web.Extensions,  
        Version=3.5.0.0,Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, 
        System.Web.Routing, Version=3.5.0.0, Culture=neutral, 
        PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory" />
      <remove name="ScriptHandlerFactoryAppServices" />
      <remove name="ScriptResource" />

      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" 
        preCondition="integratedMode"
        type="System.Web.Script.Services.ScriptHandlerFactory, 
          System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
          PublicKeyToken=31BF3856AD364E35"/>

      <add name="ScriptHandlerFactoryAppServices" verb="*" 
        path="*_AppService.axd" preCondition="integratedMode"
        type="System.Web.Script.Services.ScriptHandlerFactory, 
          System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
          PublicKeyToken=31BF3856AD364E35"/>

      <add name="ScriptResource" preCondition="integratedMode" 
        verb="GET,HEAD" path="ScriptResource.axd" 
        type="System.Web.Handlers.ScriptResourceHandler, 
          System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
          PublicKeyToken=31BF3856AD364E35" />

      <add name="MvcScriptMap" preCondition="classicMode,bitness32" verb="*"
         path="*.mvc"modules="IsapiModule"
         scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" />

      <add name="MvcScriptMap64" preCondition="classicMode,bitness64" 
         verb="*" path="*.mvc" modules="IsapiModule" 
         scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" />

      <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" 
        path="UrlRouting.axd" type="System.Web.Routing.UrlRoutingHandler, 
         System.Web.Routing,Version=3.5.0.0, Culture=neutral, 
         PublicKeyToken=31BF3856AD364E35" />

    </handlers>
  </system.webServer>

8.       Save and close the Web.config file.

9.       Create a new Web.config file in the Views folder of your MVC Web application.

10.   Add the following entries to the new Web.config file:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <httpHandlers>
      <remove verb="*" path="*.aspx"/>
      <add path="*.aspx" verb="*"
          type="System.Web.HttpNotFoundHandler"/>
    </httpHandlers>
  </system.web>
 
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <remove name="PageHandlerFactory-ISAPI-2.0"/>
      <remove name="PageHandlerFactory-ISAPI-1.1"/>
      <remove name="PageHandlerFactory-Integrated"/>
      <add name="BlockViewHandler" path="*.aspx" verb="*"
          preCondition="integratedMode"
          type="System.Web.HttpNotFoundHandler"/>
    </handlers>
  </system.webServer>
</configuration>

11.   Copy the MVC assemblies from the install location into the Bin folder of the application by doing the following:

a.       In Solution Explorer, right-click the Bin folder and then click Add Existing Item.

b.      In the Add Existing Item dialog box, browse to the install location for ASP.NET MVC and select all the assemblies (*.dll) in that folder. For information about the install location, see The New Releases elsewhere in this document.

c.       Click Add.

 

Upgrading an ASP.NET Web Application that Uses ASP.NET Controls for Silverlight

If you are upgrading from the ASP.NET 3.5 Extensions Preview Web application to use Silverlight Tools Beta 1 for Visual Studio 2008, follow these steps.

Note    These steps do not describe the code changes that will be necessary to convert your Web application. In addition, these steps assume that you are using only the ASP.NET server controls for Silverlight, and not any other feature from the previous releases.

1.       Make sure that you have followed the procedure described in the General Steps section.

2.       Open the Web.config file.

3.       Modify the following entry in the <pages><controls> section that maps the asp: tag prefix to the System.Web.UI.SilverlightControls namespace by changing the assembly name from System.Web.Extensions to System.Web.Silverlight:

<add tagPrefix="asp" namespace="System.Web.UI.SilverlightControls"
  assembly="System.Web.Silverlight" />

4.       Save and close the Web.config file.

5.       Copy the asssembly that contains the ASP.NET server controls for Silverlight into the Bin folder of the application by doing the following. The procedure differs slightly depending on whether you are working with a Web Application Project or a Web site project.

For a Web Application Project, do the following:

a.       In Solution Explorer, right click References, and then click Add Reference.

b.      In the Add Reference dialog box, browse to the install location for ASP.NET server controls for Silverlight and select the System.Web.Silverlight assembly (*.dll). For information about the install location, see The New Releases elsewhere in this document.

c.       Click OK.

For a Web site project, do the following:

a.       In Solution Explorer, right-click the Bin folder and then click Add Existing Item.

b.      In the Add Existing Item dialog box, browse to the install location for ASP.NET server controls for Silverlight and select the System.Web.Silverlight assembly (*.dll). For information about the install location, see The New Releases elsewhere in this document.

c.       Click Add.

 

An ASP.NET 3.5 Extensions Preview Web Application Project template will include the MediaPlayer and Silverlight controls in the ASP.NET 3.5 Extensions tab in Visual Studio. Make sure that you use the controls that are in the Silverlight tab instead. You can remove controls from the ASP.NET 3.5 Extensions tab of the Toolbox. However, typically if you have modified the Web.config file by following the steps listed previously, and you then close the Web application and reopen it, the ASP.NET 3.5 Extensions tab will no longer be available.

In addition to these changes, you might need to change existing code to fix compilation errors that occur due to API changes and breaking changes.


API Changes and Breaking Changes from the ASP.NET 3.5 Extensions Preview Release

This section describes changes in the APIs and breaking changes that can cause errors in existing applications.

ASP.NET MVC

This section describes API and breaking changes for ASP.NET MVC.

Routes

The following changes have been made to the Route class and related types:

  • Added new RouteValueDictionary class. The class has a constructor that accepts an object dictionary in order to populate the dictionary.
  • Updated the default project template to include a static RegisterRoutes method in Global.asax. This makes it easier for unit tests to call the method when testing routes. No changes are needed in your existing code to accommodate this change.
  • Added a RouteBase abstract base class from which Route now inherits. This class has only abstract methods. No changes are needed in your code.
  • Removed the default constructor from the Route class to prevent creating a Route instance in an invalid state.
  • Added the DataTokens property to the Route class. This property is used to store data associated with a Route that does not affect routing.
  • Changed the RouteHandler property of Route so that it now takes an instance of IRouteHandler rather than a type.
  • Changed the properties of the Route class (Defaults and Constraints) from type Object to type RouteValueDictionary. You must update route declarations in the Global.asax.cs file to pass a RouteValueDictionary object instead of an anonymous object dictionary, as shown in the following example.
  • Changed the marker for route parameters from square brackets ( [ ] ) to braces ( { } ).

Example: Defining Routes Changes (Before)

protected void Application_Start(object sender, EventArgs e)
{
    RouteTable.Routes.Add(new Route
    {
        Url = "[controller]/[action]/[id]",
        Defaults = new { action = "Index", id = (string)null },
        RouteHandler = typeof(MvcRouteHandler)
    });
 
    RouteTable.Routes.Add(new Route
    {
        Url = "Default.aspx",
        Defaults = new { controller = "Home", action = "Index",
            id = (string)null },
        RouteHandler = typeof(MvcRouteHandler)
    });
}

Example: Defining Routes Changes (After)

public void RegisterRoutes(RouteCollection routes)
{
    // Note: Change the URL to "{controller}.mvc/{action}/{id}" to enable
    //       automatic support on IIS6 and IIS7 classic mode
 
    routes.Add(new Route("{controller}/{action}/{id}", new MvcRouteHandler())
    {
        Defaults = new RouteValueDictionary(new { action = "Index",
            id = ""}),
    });
 
    routes.Add(new Route("Default.aspx", new MvcRouteHandler())
    {
        Defaults = new RouteValueDictionary(new { controller = "Home",
            action = "Index", id = ""  }),
    });
}
 
protected void Application_Start(object sender, EventArgs e)
{
    RegisterRoutes(RouteTable.Routes);
}

Controller

The following changes have been made to the Controller class and related types:

  • Removed the ControllerActionAttribute class. When you define action methods in your controller, you must remove this attribute.

    Note   To mark a public method so that it is not treated as an action method, add the NonActionAttrbute attribute.

  • Renamed the ViewFactory property to ViewEngine and changed the type to IViewEngine.
  • Renamed OnPreAction to OnActionExecuting and changed the parameter arguments.
  • Renamed OnPostAction to OnActionExecuted and changed the parameter arguments.

Example: Controller Changes (Before)

public class HomeController : Controller
{
    [ControllerAction]
    public void Index()
    {
        RenderView("Index");
    }
 
    protected override bool OnPreAction(string actionName,
        MethodInfo methodInfo)
    {
        // Do something.
    }
 
    protected override void OnPostAction(string actionName,
        MethodInfo methodInfo)
    {
        // Do something.
    }
}

Example: Controller Changes (After)

public class HomeController : Controller
{
    public void Index()
    {
        RenderView("Index");
    }
 
    protected override void OnActionExecuting(FilterExecutingContext
        filterContext)
    {
        // Do something.
    }
 
    protected override void OnActionExecuted(FilterExecutedContext
        filterContext)
    {
        //Do something.
    }
}

Action Filters

The following changes have been made to action filters:

  • Added the base ActionFilterAttribute class, which lets you create custom filters that can be applied to a controller or its action members.

Extensibility

The following changes have been made to ASP.NET MVC extensibility:

  • Changed the IControllerFactory interface. The CreateController method now takes a string for the controller name instead of a type instance.
  • Moved the default controller instantiation code to the new DefaultControllerFactory class, which implements IControllerFactory.
  • Renamed IViewFactory to IViewEngine and removed the IView interface.
  • In ControllerBuilder, renamed SetDefaultControllerFactory to SetControllerFactory, which now has an override that takes an instance of IControllerFactory.
  • Added MasterName and ViewName properties to ViewContext.
  • Added a Writer property (of type HtmlTextWriter) to the ViewPage, ViewMasterPage, and ViewUserControl classes.
  • Renamed WebFormViewFactory to WebFormViewEngine.
  • Added the Dispose method to the IControllerFactory class to support IOC recycling semantics.
  • Changed the UpdateFrom method to BindingHelperExtensions.UpdateFrom.
  • Added many rendering helper methods.

Visual Studio

The following changes have been made in Visual Studio for ASP.NET MVC:

  • Added a dialog box that lets you select a unit-test framework when you create an MVC project.

ASP.NET Server Controls for Silverlight

This section describes modifications and changes that have been made to the ASP.NET and Silverlight APIs.


Server API Changes

The following table lists changes that have been made for server-based APIs.

Server Area

Change

Silverlight and MediaPlayer controls
  • Renamed all events from OnSilverlight to OnPlugin. For example OnSilverlightLoaded is OnPluginLoaded.
  • Renamed SilverlightBackground to PluginBackground.
  • Renamed GetSilverlightParameters to GetPluginParameters.
  • Changed the return type of Version from System.Version to String.
  • Renamed GetSilverlightParameters to GetPluginParameters.
Silverlight control
  • Removed InstallationMode and Enum InstallationMode.
MediaPlayer control
  • Renamed Source to MediaSkinSource.
  • Removed MediaSkin and Enum MediaSkinType.

 

Client API Changes

The following table lists changes that have been made for client-based APIs.

Client Area

Change

Sys.UI.Silverlight.Control
  • Changed onSilverlight events to onPlugin events. For example, add_silverlightLoaded and remove_silverlightLoaded are now add_pluginLoaded and remove_pluginLoaded, and onSilverlightLoaded is now onPluginLoaded.
  • Renamed silverlightDispose to pluginDispose.
  • Removed addEventListeners. Use addEventListener instead.
Sys.UI.Silverlight.MediaPlayer
  • Renamed get_autoCue and set_autoCue to get_autoLoad and set_autoLoad.

(General)

  • Removed the SilverlightPlugin.js script.

 


Known Issues in the New Releases

ASP.NET MVC

Issue

The installer does not create a mapping for the .mvc extension in IIS 6.0 on Windows Server 2003 x64.

Workaround

Manually add the .mvc extension in IIS 6 by following these steps:

1.       Open IIS.

2.       Right-click the Web application and then click Properties.

3.       Click the Virtual Directory tab, and then click Configuration.

4.       In the Mappings tab, check whether the .mvc file-name extension is already mapped.

5.       If .mvc is already mapped, make sure that it is mapped to the following framework folders, depending on what type of computer you are using.

On an x86 machine, make sure the extension is mapped to this DLL:

%WINDIR%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

On an x64 machine, make sure the extension is mapped to this DLL:

%WINDIR%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll

6.       If the .mvc file-name extension is not already mapped, do the following:

a.       Click Add.

b.      For Executable, browse to one of the following paths, depending on which version of the .NET Framework you are using:

%WINDIR%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

-or-

%WINDIR%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll

c.       For Extension, enter ".mvc".

d.      Under Verbs, select Limit to and then enter "GET,HEAD,POST,DEBUG".

e.      Select the Script engine check box.

f.        Clear the Check that file exists check box.

g.       Click OK.

Issue

Targeting the .NET Framework version 2.0 or version 3.0 is not supported.

Workaround

None.

Issue

When you create a new MVC Web application, the Warnings window indicates that the System.Web.Abstractions assembly could not be loaded.

Workaround

Build the Web application. This will copy the assembly into the Bin folder of the Web application.

Issue

If you have installed ASP.NET MVC Preview 2, and you then uninstall the ASP.NET 3.5 Extensions CTP (December 2008), this unregisters the .mvc extension in IIS 6.0 or IIS 5.0, which breaks MVC applications.

Workaround

Register the .mvc extension in IIS.

Issue

You cannot uninstall the ASP.NET 3.5 Extensions CTP (December 2008) release by rerunning the installer .exe program.

Workaround

Uninstall the release by using the Add or Remove Programs application in the Windows Control Panel.

Issue

If you install ASP.NET MVC Preview 2 and then install the ASP.NET 3.5 Extensions CTP (December 2008) release, the New Project dialog box displays two templates for an ASP.NET MVC Web application.

Workaround

Make sure that you use the correct project template to create an ASP.NET MVC Preivew 2 application. The description for the correct template is "A project for creating an application using the ASP.NET MVC framework (Preview 2) (.NET Framework 3.5)".

Featured ASP.NET 3.5 Hosting

Voted 2008 "Best ASP.NET Host" by asp.netPRO Magazine

  • ASP.NET 3.5 / 2.0 Hosting
  • ASP.NET 3.5 Exts. Compatible
  • .NET 3.5 Framework w/ LINQ
  • AJAX & Silverlight Ready
  • Windows Server 2008/IIS 7.0 Available
  • Windows Server 2003/IIS 6.0 Available

3 MONTHS FREE – CLICK HERE!