[Original] extaspnet Secret Garden (III)-site-level Configuration

Source: Internet
Author: User

As the site-level configuration file web. config, Let's first look at the extaspnet-related projects:

   1:  <?xml version="1.0"?>
   2:  <configuration>
   3:      <configSections>
   4:          <section name="ExtAspNet" type="ExtAspNet.ConfigSection, ExtAspNet" requirePermission="false"/>
   5:      </configSections>
   6:      <ExtAspNet EnableBigFont="true" DebugMode="true" />
   7:      <appSettings/>
   8:      <connectionStrings/>
   9:      <system.web>
  10:          <pages>
  11:              <controls>
  12:                  <add assembly="ExtAspNet" namespace="ExtAspNet" tagPrefix="ext"/>
  13:              </controls>
  14:          </pages>
  15:          
  16:              <add name="ExtAspNetScriptModule" type="ExtAspNet.ScriptModule, ExtAspNet"/>
  17:          
  18:          
  19:              <add verb="GET" path="res.axd" type="ExtAspNet.ResourceHandler, ExtAspNet"/>
  20:          
  21:      </system.web>
  22:  </configuration>
 
Global parameters in the extaspnet Section
    • Theme: Control topic. Currently, three theme styles (blue/gray/access, default value: Blue) are supported)
    • Language: Control Language (EN/zh_cn/zh_tw/..., default value: zh_cn)
    • Formmessagetarget: Display location of the error message in the form field (side/QTip, default value: side)
    • Formoffsetright: width of the border to the right of the form field (default: 20px)
    • Formlabelwidth: the label width of the form field (default value: 100px)
    • Formlabelseparator: form field label and content separator (default value :":")
    • Enableajax: whether to enable Ajax (default value: True)
    • Ajaxtimeout: Ajax timeout time (unit: seconds, default value: 60 s)
    • Enablebigfont: whether to enable the large font. Change the default 11px font of extjs to 12px. Otherwise, the Chinese font displayed is too small (default: false)
    • Debugmode: whether to use the development mode. When enabled, the JavaScript code of the output page is formatted to facilitate debugging (default value: false)
 
Note:Enablebigfont is used to rewrite the default 11px font to 12px, because the Chinese font displayed with 11px is too small. We recommend that you enable this parameter.
When debugmode is enabled, the Javascript generated on the output page is formatted (as shown in), so that problems can be found during debugging. Do not disable this parameter when releasing the page.

 
 
Configuration in system. Web Section

1. The pages-> controls section defines the prefix of the control referenced on the ASPX page. For example, the buttons on the page are defined as follows:

<Ext: button id = "button1" text = "show all" runat = "server"> </ext: button>

Note:As we mentioned in the previous section, although you can add the following statement in the header of each page: <% @ register Assembly = "extaspnet" namespace = "extaspnet" tagprefix = "Ext" %> however, this approach is too cumbersome and is recommended on the web. add this configuration item in config.

 


2. The httpmodules section aims to use ASP. NET's response. Redirect method in the Ajax environment.

When we use the ASP. NET response. Redirect method, the response status code is 302, and the page to be redirected is specified in the location Response Header, as shown in:

Check the source code of scriptmodule. cs. We will find that this class intercepts the HTTP response, filters out the 302 response, and returns a piece of JavaScript code:

   1:  if (response.StatusCode == 302)
   2:  {
   3:      string redirectLocation = response.RedirectLocation;
   4:      response.Write(String.Format("window.location.href='{0}';", redirectLocation));
   5:  }
 
Note:If you do not use the response. Redirect method in the code, you do not need to add this configuration item. In this case, you can also use the pagecontext. Redirect method provided by extaspnet. It serves the same purpose as response. Redirect. Pagecontext is a static class provided by extaspnet to help output a common JavaScript code. You can view the source code to obtain more information.
 
 

3. The httphandlers section aims to reference the built-in icons in extaspnet in JavaScript.

Extaspnet has many built-in icons. For the complete list, see http://extasp.net/config/icons.htm.

In JavaScript, it can be referenced as follows:

var icon1 = "./res.axd?icon=PageWhiteCode";
 
In fact, before introducing this configuration, there is also a way to get the built-in icon address:
var icon1 = '<%= IconHelper.GetIconUrl("PageWhiteCode") %>';
However, the latter method has two disadvantages:
1. This code must be placed in the aspx code.
2. The generated icon address is long.

, Similar to/webresource. axd? D = udw5yuf2dlqbmvxruqv3dtdj1_0rlswtcbxrvdha0tgwb3upjguodhzh1yeg _ blank & t = 634405189453149561
 

Note:If you do not reference the icons built in extaspnet. dll in Javascript, you do not need to add this configuration item.

 

Summary

A simple web. config still contains a lot of knowledge. As long as we calm down and think more, there will always be gains.

In the next article, we will focus on the pagemanager control. Why do we need to add a pagemanager control to every page?

 

 

Note: "extaspnet Secret Garden" series of articles are original from sanshenshi, blog Park first launched, reprinted please indicate the source. Document Catalog official forum

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.