You need to put them in the correct <system.web>
section. e.g.:
<configuration>
<system.web>
<pages>
<namespaces>
<add namespace="System.Data" />
<add namespace="System.Text"/>
</namespaces>
</pages>
</system.web>
</configuration>
and put them in the correct web.config
i.e. the second web.config
file is the Views
folder and is specific to views. These settings do not go in the root web.config.
The purpose of these settings is to make the libraries available to the ASPX pages (e.g. for Intellisense) and it is not used for the code-behind. You still need to have using
statements in your actual code as that is just plain c# programming.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…