简体   繁体   中英

Web Application Project not picking up on namespaces in Web.Config

any idea why this is?

I have one web site project and it has the added namespaces in the web.config & it works. However, I created a new web application project & used the same web.config code to add the namespaces.

<pages theme="Default">
        <namespaces>
          <clear />
          <add namespace="AjaxControlToolkit" />
          <add namespace="System" />
          <add namespace="System.Collections" />
          <add namespace="System.Collections.Generic" />
          <add namespace="System.Collections.Specialized" />
          <add namespace="System.Configuration" />
          <add namespace="System.Data" />
          <add namespace="System.Data.SqlClient" />
          <add namespace="System.IO" />
          <add namespace="System.Linq" />
          <add namespace="System.Net.Mail" />
          <add namespace="System.Text" />
          <add namespace="System.Text.RegularExpressions" />
          <add namespace="System.Web" />
          <add namespace="System.Web.Caching" />
          <add namespace="System.Web.SessionState" />
          <add namespace="System.Web.Security" />
          <add namespace="System.Web.Profile" />
          <add namespace="System.Web.UI" />
          <add namespace="System.Web.UI.WebControls" />
          <add namespace="System.Web.UI.WebControls.WebParts" />
          <add namespace="System.Web.UI.HtmlControls" />
          <add namespace="System.Xml" />
          <add namespace="System.Xml.Linq" />
          <add namespace="System.Xml.XPath" />
          <add namespace="System.Xml.Xsl" />
          <add namespace="System.DirectoryServices" />
          <add namespace="ASPeXtended" />
        </namespaces>
        <controls>
          <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          <add tagPrefix="ajax" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
          <add tagPrefix="aspx" namespace="ASPeXtended" assembly="ASPeXtensions" />
          <add tagPrefix="bar" namespace="Neodynamic.WebControls.BarcodeProfessional" assembly="Neodynamic.WebControls.BarcodeProfessional" />
        </controls>
      </pages>

However i'm still getting errors like error BC30002: Type 'MailMessage' is not defined, even thou <add namespace="System.Net.Mail" /> is in the root web.config.

???

Figured out that this is because of differences between a Web Site Project and Web Application Project.

If you stumble on to this question, this link may help.

http://msdn.microsoft.com/en-us/library/dd547590(v=vs.110).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM