Asp.net| problem
These days to upgrade the original 1.1 items, found some problems, summed up here, but also to remind you have not had time to upgrade or ready to upgrade the friend, the process of upgrading less detours, less waste.
1. Global.asax files are handled in a different way
An error will occur after conversion, in VS2003 Global.asax has a code-behind file, 2.0, move the code-separated file to the App_Code directory so that it automatically becomes accessible through any ASP.net page in the application. The "Code-behind" property will be removed from the instructions in the ASAX file. Vs2005 writes the code directly in Global.asax. So you need to delete the converted file to rejoin and copy the corresponding code over.
2. 2.0 no project file.
In 1.1 applications, the project file contains build settings, references to external assemblies, and a list of files in the project. In 2.0 applications, version settings and file lists are no longer required because all files under the Web project directory are considered part of the Web project.
3. Code separation mode.
In ASP.net 1.1, code-detach mode separates content (for example, test.aspx) from code (for example, Test.aspx.cs). The content page inherits from the Code detach page, and the Code-splitting page contains the code generated by the user and the designer.
asp.net 2.0 by using local classes to enhance code-splitting patterns, you can use the partial keyword to separate the code of a single class into two separate files. It allows a class to span multiple files. In the new code-splitting pattern, the content page inherits from the compiled class, consisting of the corresponding code-splitting page and the auto-generated stub file, which is used to define the field declarations for the controls used in the content page. This change makes the auto-generated code separate from the user's code and makes the code-splitting page significantly smaller and simpler. The local class structure also reduces the risk of accidentally damaging pages because of the code generated by the editing designer.
If an error occurs, check to see if there is a partial keyword, otherwise add the partial keyword.
4. Grammar check.
asp.net1.1 programs, compile-time will not check the ASPX, ASPCX, and other files in the syntax errors, and vs2005 compile-time will check all aspx, ASPCX and other files in the syntax, so if there is a syntax error, will cause the compilation cannot pass.
5. The control declaration.
If all the controls are declared on an. aspx page, all control declarations are removed from the code-behind file, otherwise the error is: duplicate definition.
6. (C # only) moves the event hook code from the Initialzecomponent function of the code-separated file to the. aspx page.
Note that this action does not apply to events that are automatically invoked, including Page_Init, Page_Load, Page_databind, Page_PreRender, Page_Unload, Page_Error, Page_ Aborttransaction and Page_committransaction.
7. How to deploy (precompiled, full compile, updatable site, etc.).
In 1.x, Web applications are precompiled and deployed as a large assembly. Content pages (*.aspx) are not compiled on the server, but can be edited on the server. With the new page-compilation schema and directory structure, you can deploy ASP.net 2.0 applications using a variety of configurations. In one case, you can precompile all ASPX pages and deploy a WEB application composed of fully compiled assemblies. In this mode, you cannot easily change the application on the server. Alternatively, you can deploy the application without precompiling any code. In this configuration, you can change an. aspx page, code-splitting file, or any other code in the application directly on the server. When a user requests a page on the server, the page is dynamically compiled.
8. Change all codebehind properties in an. aspx page to the CodeFile property
Codebehind: Specifies the name of the compiled file that contains the class associated with the page. This property cannot be used at run time.
This property is provided for compatibility with previous versions of ASP.net to achieve code-behind functionality. In asp.net version 2.0, you should specify the name of the source file by using the CodeFile property instead, and use the Inherits property to specify the fully qualified name of the class.
CodeFile
Specifies the path to a code-behind file that points to a page reference. This property is used in conjunction with the Inherits property to associate a code-behind source file with a Web page. This property is valid only for compiled pages.
9. All separate code files and AssemblyInfo.cs are moved to the App_Code directory.
However, after you run the Conversion Wizard, you may find that some code-separated files (for example, *.aspx.cs or *.ascx.vb) are moved to the App_Code directory. This indicates that the content page of the code-splitting file contains malformed Codebehind directives and is not set correctly. That is, the conversion wizard cannot determine whether the code-splitting file is actually bound to a particular. aspx page.
10.Web Service
In ASP.net 1.x, Web service (. asmx) is automatically split into a blank title page (. asmx) and a code-splitting file that contains the actual method.
asp.net2.0 under:
• Move the code-separated class to the App_Code directory so that it automatically becomes accessible through any ASP.net page in the application.
• Change the Codebehind property in the. asmx file to point to the new location.
(Note that the code-splitting file does not use the partial class, so continue using the Codebehind property.) )
• Change all default, Friend, and Internal-scoped declarations to public.
What problems have you encountered in the 1.1 to 2.0 upgrade process? Can write down to let everyone learn together, less detours.