ASP.NET母版页错误

时间:2015-02-24 13:04:12

标签: asp.net

母版页允许您为Web应用程序中的所有页面(或页面组)创建一致的外观和行为。

我有一个网站给我以下错误:

Content controls are allowed only in content page that references a master page.

我的主页

  <%@ Master Language="C#" AutoEventWireup="true"  Inherits="mstrPageMain" Codebehind="mstrPageMain.master.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="x-ua-compatible" content="IE=10"/>
    <title>Untitled Page</title>
</head>
<body>
    <script type="text/javascript">
        $(document).ready(function () {
            if (/msie/.test(navigator.userAgent.toLowerCase())) {
                $('input[type=text]').each(function () {
                    //work around for ie10 clipping text
                    $(this).val($(this).val());
                });
            }
        });
    </script>
    <form id="form1" runat="server" autocomplete="off">
    <asp:Image ID="imLogo" runat="server" />
     <div class="section" style="margin-top:2px">  
        <table width="100%">
        <tr>
            <td align="left">
                <asp:SiteMapPath ID="smpPath" runat="server" PathSeparator="  >  ">
                </asp:SiteMapPath>

             </td>
             <td align="right" style="width: 10%">
                 <asp:LoginStatus ID="LoginStatus1" runat="server" OnLoggingOut="LoginStatus1_LoggingOut" />
             </td>
        </tr>
        </table>
        </div>
<div class="divSettings">  
        <table width="100%" class="area">
        <tr>
            <td valign="top" style="Width:160px">
                <asp:Menu ID="mnLeft" Width="160px" runat="server" DataSourceID="smdsMenu" StaticDisplayLevels="3"  OnMenuItemDataBound="mnLeft_MenuItemDataBound" CssClass="tree">
                <LevelMenuItemStyles>
                    <asp:MenuItemStyle ForeColor="Black" Font-Bold="false" Font-Names="Arial" Font-Overline="false" Font-Size="14px" />                    
                </LevelMenuItemStyles>
                </asp:Menu>
            </td>
            <td valign="top" align=left>
                <asp:contentplaceholder id="cphMainContainer" runat="server" />
            </td>
        </tr>
        </table>
        <asp:SiteMapDataSource ID="smdsMenu" runat="server" ShowStartingNode="false" />  
</div>   
    <div class="divSettings">
         <table width="100%" class="copyright">
         <tr>
            <td align="center"><%=Resources.Resource.Vba32ControlCenterTitle%>, <%=Resources.Resource.Version%>&nbsp;<asp:Label ID="lblVersion" runat="server"></asp:Label></td>
            </tr>
            <tr>
            <td align="center">Copyright (c) 2008-<%=DateTime.Now.Year%> VirusBlokAda Ltd.</td>
        </tr>
        </table>
    </div>
    </form>
</body>
</html>

Default.aspx的

    <%@ Page Language="C#" validateRequest="false" MaintainScrollPositionOnPostback="true" MasterPageFile="~/mstrPageMain.master" AutoEventWireup="true" Inherits="_Default" Title="Untitled Page" Codebehind="Default.aspx.cs" %>

<%@ Register Assembly="CustomControls" Namespace="VirusBlokAda.CC.CustomControls" TagPrefix="cc1" %>
<%@ OutputCache Location="None" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphMainContainer" Runat="Server">
   <div class="title"><%=Resources.Resource.Information%></div>
    <div class="divSettings">
        <div class="subsection"><%=Resources.Resource.Administrator%></div>
        <table class="ListContrastTableMain">
            <tr>
                <td  style="padding-left:5px">
                    <%= Resources.Resource.UserLogin %>:
                </td>
                <td style="width:50%">                    
                    <asp:LoginName ID="lgName" runat="server" />
                </td>
            </tr>
            <tr>
               <td style="padding-left:5px">
                    <%= Resources.Resource.FirstName %>:
                </td>
                <td style="width:50%">
                    <%= Profile.FirstName == String.Empty ? "admin" : Profile.FirstName%>
                </td>
            </tr>
            <tr>
                <td style="padding-left:5px">
                    <%= Resources.Resource.LastName %>:
                </td>
                <td style="width:50%">
                    <%= Profile.LastName == String.Empty ? "admin" : Profile.LastName%>

                </td>
            </tr>
                         <tr>
                <td style="padding-left:5px">
                    <%= Resources.Resource.Role %>:
                </td>
                <td style="width:50%">
                    <%= Roles.IsUserInRole("Administrator")? Resources.Resource.Administrator:"" %>
                    <%= Roles.IsUserInRole("Operator")? Resources.Resource.Operator:"" %>
                    <%= Roles.IsUserInRole("Viewer")? Resources.Resource.Viewer:"" %>
                </td>
            </tr>
            <tr>
                <td style="padding-left:5px">
                    <%= Resources.Resource.LastLogin %>:
                </td>
                <td style="width:50%">
                    <asp:Label ID="lblLastVist" runat="server" SkinID="LabelContrast"></asp:Label>
                </td>
            </tr>
            <!--
            <tr>
                <td style="padding-left:5px">
                    <%= Resources.Resource.BrowserType %>:
                </td>
                <td style="width:50%">
                    <%=Request.Browser.Browser %>&nbsp;<%=Request.Browser.MajorVersion%>.<%=Request.Browser.MinorVersion%>

                </td>
            </tr>
            -->
            </table>
            <!-- My code -->

           <div class="subsection"><%=Resources.Resource.LicenseKey %></div>
           <table class="ListContrastTableMain">
            <tr runat="server" id="rowSuccess" class="stateKeyBad" visible="false">
                <td colspan="2" align="center"><asp:Label runat="server" ID="lblSuccess"><%=Resources.Resource.KeyNotFound %></asp:Label></td>                
            </tr>
            <tr runat="server" id="rowLicenseNumber">
                <td style="padding-left:5px">
                    <%=Resources.Resource.LicenseNumber %>
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblLicenseNumber"/>&nbsp;&nbsp;
                </td>
            </tr> 
            <tr runat="server" id="rowCustomerName">
                <td style="padding-left:5px">
                   <%=Resources.Resource.CustomerName %>
                </td>
                <td style="width:50%">
                   <asp:Label runat="server" id="lblCustomerName"/>&nbsp;&nbsp;
                </td>
            </tr>
            <tr id="rowKeyState" runat="server">
                <td style="padding-left:5px">
                    <%=Resources.Resource.KeyState %>
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblKeyState"/>&nbsp;&nbsp;
                </td>
            </tr>
            <tr id="rowExpirationDate" runat="server">
                <td style="padding-left:5px">
                    <%=Resources.Resource.ExpirationDate %>
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblExpirationDate"/>&nbsp;&nbsp;
                </td>
            </tr>                                            
            <tr id="rowComputerLimit" runat="server">
                <td style="padding-left:5px">
                    <%=Resources.Resource.ComputerLimit %>
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblComputerLimit"/>&nbsp;&nbsp;
                </td>
            </tr>               
           </table>

           <!-- ************************* -->

            <div class="subsection"><%=Resources.Resource.DataBaseServer %>&nbsp;Control Center</div>
           <table class="ListContrastTableMain">
            <tr>
                <td style="padding-left:5px">
                   <%=Resources.Resource.Name %>
                </td>
                <td style="width:50%">
                   <asp:Label runat="server" id="lblARM2DataBaseDataSource"/>&nbsp;&nbsp;
                </td>
            </tr>
             <tr>
                <td style="padding-left:5px">
                  <%= Resources.Resource.User %>
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2DataBaseUserID" />
                </td>
            </tr>
            <tr>
                <td style="padding-left:5px">
                    <%=Resources.Resource.InitialCatalog %>&nbsp;Control Center
                </td>
               <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2DataBaseInitialCatalog" />
               </td>
            </tr>
            </table>
            <table class="ListContrastTableMain">
            <tr>
                <td style="padding-left:5px">
                    Name DB
                </td>
               <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2DBName" />
               </td>
            </tr>
            <tr runat="server" id="rowDBSize">
                <td style="padding-left:5px">
                    Size
                </td>
               <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2DBSize" />
               </td>
            </tr>
            <tr>
                <td style="padding-left:5px">
                    Path
                </td>
               <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2DBPath" />
               </td>
            </tr>
           </table>
           <table class="ListContrastTableMain">
            <tr>
                <td style="padding-left:5px">
                    Name DB
                </td>
               <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2LogName" />
               </td>
            </tr>
            <tr runat="server" id="rowDBLogSize">
                <td style="padding-left:5px">
                    Size
                </td>
               <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2LogSize" />
               </td>
            </tr>
            <tr>
                <td style="padding-left:5px">
                    Path
                </td>
               <td style="width:50%">
                    <asp:Label runat="server" ID="lblARM2LogPath" />
               </td>
            </tr>
           </table>


           <div class="subsection"><%=Resources.Resource.DataBaseServer %>&nbsp;Membership</div>
           <table class="ListContrastTableMain">
              <tr>
                <td style="padding-left:5px">
                    <%=Resources.Resource.Name %>
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblMembershipDataSource" />
                </td>
            </tr>
             <tr>
                <td style="padding-left:5px">
                  <%= Resources.Resource.User %>
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblMembershipUserID" />
                </td>
            </tr>
            <tr>
                <td style="padding-left:5px">
                    <%=Resources.Resource.InitialCatalog %>&nbsp;Membership
                </td>
                <td style="width:50%">
                    <asp:Label runat="server" ID="lblMembershipInitialCatalog" />
                </td>
            </tr>
        </table>

    </div>

    <div>
    <div class="subsection"><%=Resources.Resource.Vba32CCServicesState%></div>
    <asp:Table runat="server" ID="tblService" class="ListContrastTableMain" />

    </div>

</asp:Content>

的Web.config

  <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
    </sectionGroup>
  </configSections>
  <appSettings>
    <add key="VirusFoundEvent" value="vba32.virus.found" />
    <add key="Service" value="VbaTaskAssignment.Service" />
    <add key="Vba32SS" value="ipc://Vba32SS/Vba32SS.rem" />
    <add key="Version" value="2.0.0.0" />
    <add key="ErrorLog" value="error.log" />
  </appSettings>
  <connectionStrings configSource="ConnectionStrings.config" />
  <elmah>
    <security allowRemoteAccess="1" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ARM2DataBase" />
  </elmah>
  <system.web>
  <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit" />
      </controls>
    </pages>
    <compilation debug="true" targetFramework="4.0" batch="false">
      <assemblies>
        <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Drawing.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.JScript, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
  </compilation>
    <roleManager enabled="true" cacheRolesInCookie="false" />
    <sessionState timeout="40" />
    <authentication mode="Forms">
      <forms name=".ASPXFORMSAUTH" loginUrl="Logins.aspx" />
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>
    <identity impersonate="true" />
    <siteMap defaultProvider="AspNetXmlSiteMapProvider" enabled="true">
      <providers>
        <remove name="AspNetXmlSiteMapProvider" />
        <add name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true" siteMapFile="Web.sitemap" />
      </providers>
    </siteMap>
    <!-- Функционал для профайла-->
    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear />
        <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" applicationName="VbaControlCenter" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" />
      </providers>
    </membership>
    <!-- Профайл -->
    <anonymousIdentification enabled="false" />
    <profile inherits="GreateProfile.ProfileCommon">
      <!--<properties>
        <add name="FirstName" />
        <add name="LastName" />
        <add name="LastVisit" type="DateTime" />
        <add name="Culture" defaultValue="en-US" />
        <add name="MasterPage" defaultValue="mstrPageNew.master" />
        <add name="Theme" defaultValue="Main" />
        <add name="Settings" />
        <add name="CompFilters" />
        <add name="GroupFilters" />
        <add name="EventFilters" />
        <add name="TaskFilters" />
        <add name="TasksInstallFilters" />
        <add name="ComponentFilters" />
        <add name="ProcessFilters" />
        <add name="TasksList" />
        <add name="ComputerColorOptions" />
        <add name="DeviceFilters" />
        <add name="UnknownDeviceFilters" />
        <add name="DiagramFilters" />
        <add name="DeviceClassFilters" />
      </properties>-->
    </profile>
    <httpHandlers>
      <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </httpHandlers>
    <httpModules>
      <add name="HTTPModule_Clearer" type="HTMLClearer.HTTPModule_Clearer" />
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
    </httpModules>
    <!-- Необходимо для передачи файлов.
        Здесь задано максимально возможное значение.   
    -->
    <httpRuntime maxRequestLength="2097151" />
    <!--<customErrors mode="On" defaultRedirect="Error.aspx" />-->
  <customErrors mode="Off" defaultRedirect="Error.aspx" />
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
    </modules>
    <handlers>
      <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
    </handlers>
  </system.webServer>
  <location path="GetPolicy.aspx">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="Downloads">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="elmah.axd">
    <system.web>
      <authorization>
        <allow roles="administrator" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="App_Themes">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>
  <location path="js">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>
</configuration>

ConnectionStings.config

    <?xml version="1.0"?>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer"
         connectionString="packet size=4096;data source=(local)\sqlexpress;persist security info=False;initial catalog=vbaUsersMembership;Trusted_Connection=Yes;"/>
   <add name="ARM2DataBase"
         connectionString="packet size=4096;;data source=(local)\sqlexpress;persist security info=False;initial catalog=vbaControlCenterDB;Trusted_Connection=Yes;" />
  </connectionStrings>

0 个答案:

没有答案