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.
- <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
- <system.web>
- <pages>
- <namespaces>
- <add namespace ="System.IO" />
- <add namespace="System.Text"/>
- </namespaces>
- </pages>
- </configuration>
- </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.
- <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
- <system.web>
- <pages>
- <namespaces>
- <add namespace ="System.IO" />
- <add namespace="System.Text"/>
- </namespaces>
- <controls>
- <add tagPrefix="uc" namespace="xx"
- assembly="xxxx" />
- </controls>
- </pages>
- </configuration>
- </system.web>
- ASP. NET TypeConverter
- Analysis on TypeResolver of ASP. NET
- Define JavaScriptConverter in ASP. NET
- How to replace Sys. Services in ASP. NET
- Use Profile Service of ASP. NET AJAX