Aspx page in ASP. NET

Source: Internet
Author: User

It seems that this question is long, but in fact, when I read the information, I found that in ASP. in NET 2.0, you only need. config defines the namespaces you want to use, so you do not need to use <% @ import namespace = "system. text "%>.

For example, you only need to use this method in web. config.

 
 
  1. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 
  2. <system.web> 
  3. <pages> 
  4. <namespaces> 
  5. <add namespace ="System.IO" /> 
  6. <add namespace="System.Text"/> 
  7. </namespaces> 
  8. </pages> 
  9. </configuration> 
  10. </system.web> 

In this way, in all the aspx pages (note that it is not the codebehind page), you do not need to use the import method.

Similarly, in ASP. NET 1.1, the reference of custom controls is also very troublesome on the aspx page. in ASP. NET 2.0, it can be defined in web. config.

 
 
  1. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 
  2. <system.web> 
  3. <pages> 
  4. <namespaces> 
  5. <add namespace ="System.IO" /> 
  6. <add namespace="System.Text"/> 
  7. </namespaces> 
  8. <controls> 
  9. <add tagPrefix="uc" namespace="xx" 
  10. assembly="xxxx" /> 
  11. </controls> 
  12. </pages> 
  13. </configuration> 
  14. </system.web> 
  1. ASP. NET TypeConverter
  2. Analysis on TypeResolver of ASP. NET
  3. Define JavaScriptConverter in ASP. NET
  4. How to replace Sys. Services in ASP. NET
  5. Use Profile Service of ASP. NET AJAX

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.