Key Benefits
- The new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and more.
- To take advantage of better Debugging and error checking.
- The ASP.NET 2.0 compiler automatically compiles application code and dependent resources when a request is made to a resource on your Web site.
- In the ASP.NET page compilation model, code-behind files are compiled at run time into multiple assemblies on first request to the corresponding .aspx files.
- Improved markup and code separation, reserved application folders, and automatic code compilation provided by .NET 2.0 framework.
- The new code-behind model based on partial classes allows greater separation of markup and code, and removes the need for control declarations and event wire-up code in your code-behind files.
Migration will involve 3 phases.
- First step of migration would use the conversion wizard available in VS2005 which will automatically convert the code into .Net 2.0 compatible.
- Then next phase will involve solving compilation errors and then run-time errors.
- Testing after all the runtime and compilation errors are resolved
HTML pages (.aspx)
|
Error |
Resolution |
Reason for Change |
|
"Codebehind" error in Page directive |
Change "Codebehind" to "CodeFile" in the Page directive |
Its recommended to migrate to new code-behind model of .NET 2.0 |
|
Validation (Internet Explorer 6): Element ‘input’ is an empty element and cannot have a closing tag. |
End the input tag with /> |
|
|
The <head> tag needs to be modified |
Modify the <head> tag to <Head runat=server> |
While trying to access .css file from a theme it will generate runtime exception. |
Code behind (.cs) (C# language)
|
Errors and Resolution |
Reason for Change |
|
Commenting Server Side controls from the CodeBehind File. |
|
|
Protection Level error – All Control event needs to be converted to protected instead of private. |
Since Visual Studio 2005 now uses multiple assemblies, the access level to member variables and functions need to be modified if you want to access them from another assembly |
|
Include the "Partial keyword" while defining the CodeBehind class. |
The two partial classes (ASPX and code behind) are merged into a single class during compilation. Partial class definition in the code-behind file is to take advantage of improved markup and code separation as well as automatic page compilation |
|
Member names cannot be the same as their enclosing type. Change the form Id or class name. |
This is because of changing page compilation model between ASP.Net 1.1 and 2.0. In 2.0, the "Form" control is defined in the same class where the page is defined. In case of change of form Id then the form Id in the javascript also needs to be changed otherwise the scripts won’t work. |
|
Error using TreeNode object. Use aliases to access Microsoft.Web.UI.WebControls objects using mTreeNode = Microsoft.Web.UI.WebControls; mTreeNode.TreeNode oTNR = new mTreeNode.TreeNode(); mTreeNode.TreeViewSelectEventArgs |
Since ‘TreeNode’ is an ambiguous reference between ‘System.Web.UI.WebControls.TreeNode’ and ‘Microsoft.Web.UI.WebControls.TreeNode‘ So we need to explicitly specify parent class |
Run time Issues and Resolution
|
Errors |
Resolution |
|
Values of read-only fields couldn’t be fetched at server side code. |
Access values of that control using their Unique Id property. Eg: - this.txtStartDate.Text = Request[this.txtStartDate.UniqueID]; |
|
In case of drop-down list if there is no data then on setting its selected index to 0 an error is generated. |
It needs to be set to -1 if the drop-down list is empty. In case of .NET 1.0 no error is generated. |
|
Using Resource Manager to manage resource in Web application |
Visual Studio 2005 uses non-deterministic assembly naming, you will need to change your code to use the new resource model. First move resource to a special folder named App_GlobalResources. This will automatically make any resource found in that folder available via strong naming. Eg:- Assembly asmGlobal = Assembly.Load("App_GlobalResources"); System.Resources.ResourceManager rm = new System.Resources.ResourceManager (resName, Assembly.Load("App_GlobalResources")); |
More issues and Resolutions
|
Error |
Resolution |
Reason for Change |
|
Unable to switch to design view |
Make sure tags in the aspx page are well formed. |
|
|
Ambiguous references and naming conflicts. |
Consider explicit naming convention. |
New namespaces and classes have been added to .Net Framework 2.0 which might cause clashes with 1.0 applications |
Web Config file Changes
|
Changes |
Reason for Change |
|
Adding new validations to remove specific errors on page. <xhtmlConformancemode="Legacy"/> enableEventValidation="false“ validateRequest="false |
By default, all markup that is produced by ASP.NET and the Web server controls included with ASP.NET now conforms to the XHTML 1.0 Transitional standard. This can lead to unintended HTML rendering issues after migration. To solve this set mode attribute of xhtmlConformancemode to legacy. |
|
To use IE web controls in the project. |
<configSections> <section name="MicrosoftWebControls" type="System.Configuration.NameValueSection Handler,System,Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </configSections> <MicrosoftWebControls> <add key="CommonFiles" value="/webctrl_client/1_0/"/> </MicrosoftWebControls> |
|
To use pre-processor directive in your web application |
Define the below mentioned code in web config <system.codedom> <compilers> <compiler language="c#;cs;csharp“ extension=".cs" compilerOptions="/d:DEBUG;TRACE;ENT;EN TERPRISE;SLA;BASE;" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561 934e089" /> </compilers> </system.codedom> |
Related Posts
- DotNet Framework Fundamentals
- ASP.Net 4.0 | The ability to set meta tags
- Routing in ASP.NET 4.0 vs Routing in ASP.Net 3.5
- Search Engine Friendly URL (URL Mapping) in ASP.Net 2.0
- Sybase with DotNet Application and SQL Server Reporting Services
Tags: DotNet Framework Upgrade, Framework 1.1 to 2.0, Framework Migration, Issues and Resolution




