首页 > 代码库 > asp.net WebPages 网页添加默认命名空间

asp.net WebPages 网页添加默认命名空间

asp.net 网页框架常用的三种: WebForm,Mvc,WebPages

1.WebForm

直接在 system.web/pages 下添加

2.Mvc

新建个Mvc项目,直接复制

3.WebPage

大致上与Mvc相同,区别在于

host factoryTypepages pageBaseType

<host factoryType="System.Web.WebPages.Razor.WebRazorHostFactory, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /><pages pageBaseType="System.Web.WebPages.WebPage">
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">            <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />            <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />        </sectionGroup>
    <system.web.webPages.razor>        <host factoryType="System.Web.WebPages.Razor.WebRazorHostFactory, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />        <pages pageBaseType="System.Web.WebPages.WebPage">            <namespaces>                <add namespace="FDOA.Webpages.Common"/>            </namespaces>        </pages>    </system.web.webPages.razor>