In the past few months, I have been in touch with the development of ArcGIS server9.2. This is also the first time that I have developed WebGIS by myself. During this period, I encountered many problems. The most prominent issue is the deployment of WebGIS for secondary development and Character Set conflicts. For the problem description, see《Ask questions about how to deploy ArcGIS Server 9.2."And《?? ArcGIS Server DOTNET web ADF template example problems after changing the character set". Esri bbs also asked questions about the consent. Since the time was intermittent, these questions have not been found a good solution, and they have been solved in the last few days. Therefore, I would like to summarize them here.
1. Solutions to the map data source problems during deployment:
Add a map data source section in Web. config. during deployment, you only need to modify the value in Web. congfig. It is the 2nd method mentioned in the article that should have been done for a long time. It is a permanent solution that can be shared in all the places where map resources are used. The details are as follows. In the Web. config file:
<Deleetask>
<! -- Map data source -->
<Add key = "mapdatasource" value = "myhost"/>
</Appsettings>
Suppose a class is commonuntility and adds several static methods. Of course, you can also encapsulate many map resource access operations here.
1 Public Class Commonuntility
2 {
3 Static Mapresourcemanager m_mapresourcemanager;
4 Static Mapresourceitem resourceitem; // Map Data Source
5 String Querylayer; // Layer name
6 // Set Map Data Source
7 Static Private Void Setresourmng ()
8 {
9 If (Resourceitem ! = Null )
10 {
11 Return ;
12 }
13 Resourceitem = New Mapresourceitem ();
14 Resourceitem. Name = " Mapresourceitem0 " ;
15 Resourceitem. Definition = New Gisresourceitemdefinition ();
16
17 // Obtain map data sources
18 String Mapdatasource = Configurationmanager. deleettings [ " Mapdatasource " ];
19 Resourceitem. Definition. performancedefinition = Mapdatasource;
20 Resourceitem. Definition. datasourcetype = " ArcGIS Server local " ;
21
22 Resourceitem. Definition. resourcedefinition = " Layers @ Xian " ;
23 Resourceitem. Definition. datasourceshared = True ;
24
25 Resourceitem. displaysettings = New Displaysettings ();
26 Resourceitem. displaysettings. displayintableofcontents = True ;
27 Resourceitem. displaysettings. Visible = True ;
28
29 M_mapresourcemanager = New Mapresourcemanager ();
30 M_mapresourcemanager.resourceitems.insert ( 0 , Resourceitem );
31 M_mapresourcemanager.createresource (resourceitem );
32 Resourceitem. initializeresource ();
33 }
34 // Obtain resourceitem
35 Static Public Mapresourceitem getresourceitem ()
36 {
37 Setresourmng ();
38 Return Resourceitem;
39 }
40 }
Call getresourceitem. The call is as follows:
1 // Page Initialization
2 Protected Void Page_load ( Object Sender, eventargs E)
3 {
4 If ( ! Ispostback)
5 {
6 If (Mapresourcemanager1.resourceitems. Count = 0 )
7 {
8 Mapresourcemanager1.resourceitems. Add (commonuntility. getresourceitem ());
9 }
10 }
11 }
2. Resolution of Character Set problems:
This problem was first caused by gb2312 for HTML and UTF-8 for Aspx. There is a conflict:
A. When webconfig uses gb2312, the submission from HTML to aspx is normal, and database operations can be completed correctly. However, the editing function of the example provided by ArcGIS Server cannot be normally performed, and a script error occurs during the operation.
B. When webconfig is changed to UTF-8, the editing is normal, but the HTML-to-aspx submission fails, and the ASPX page cannot get parameters from HTML.
The previous error was caused by inconsistent codes of JS, HTML, and Aspx. Test findings:
1) the encoding of HTML does not need to be changed. You only need to rewrite the charset in <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>.
2) js code can be changed using UE or vs.net editor. aspx seems to be determined by the webconfig configuration.
3) when using ArcGIS Server, it is best to use UTF-8 for Web. config.