本文标签:aspx页面 ASP.NET
看上去这个题目比较长,但实际上,我在看资料时发现,这就是说,在ASP.NET 2.0中,只需要在web.config里定义你要用的那些namespace,则在aspx页面中就不需要再象1.1那样,用< %@ import namespace="system.text" %>来引用了 。
比如,只需要在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>
这样一来,在所有的aspx页面中(注意不是codebehind页面),则不需要再用import的方法引入了.
同样道理,在ASP.NET 1.1中,自定义控件的引用,在aspx页面中也是很麻烦的,在ASP.NET 2.0中,可以在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>
|