<%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <? xml version = "1.0" standalone ="yes" ?>
        <configuration>
          <appSettings>
           <add key = "页站名称" values = "莹莹的留言板" />
           <add key = "网站地址" values = "http://www.uestc.edu.cn" />
           <add key = "数据库路径" values = "db\data.mdb" />
           <add key = "每页显示留言数" value = "6" />
           <add key = "管理员密码" value = "admin" />
          </appSettings>
          <system.web>
            <globalization fileEncoding  = "gb2312" requestencoding = "gb2312" esponseencoding = "gb2312" />
            <trace enabled = "true" />
            <compilation defaultLanguage = "C#" debug = "true" />
          </system.web>
        </congfiguration>
    </div>
    </form>
</body>
</html>
Config文件里的代码如上,除了各种警告:不支持元素“xxx”外,还有一句“</congfiguration>没有与之匹配的开始标记”、

解决方案 »

  1.   

    怎么把Web.config的内容放在html页面里???
      

  2.   

    楼主想要表达什么意思,<configuration />这些内容都是放在web.config里面的!
      

  3.   

     <? xml version = "1.0" standalone ="yes" ?>
      <configuration>
      <appSettings>
      <add key = "页站名称" values = "莹莹的留言板" />
      <add key = "网站地址" values = "http://www.uestc.edu.cn" />
      <add key = "数据库路径" values = "db\data.mdb" />
      <add key = "每页显示留言数" value = "6" />
      <add key = "管理员密码" value = "admin" />
      </appSettings>
      <system.web>
      <globalization fileEncoding = "gb2312" requestencoding = "gb2312" esponseencoding = "gb2312" />
      <trace enabled = "true" />
      <compilation defaultLanguage = "C#" debug = "true" />
      </system.web>
      </congfiguration>
    这个怎么能在HTML页面中呢
      

  4.   

    不支持元素“xxx”外 这个警告不鸟它、关心错误就行了
      

  5.   

    有一个小伙子在一个办公大楼的门口抽着烟,一个妇女路过他身边,并对他说,“你知道不知道这个东西会危害你的健康?我是说,你有没有注意到香烟盒上的那个警告(Warning)?” 小伙子说,“没事儿,我是一个程序员”。 那妇女说,“这又怎样?” 程序员说,“我们从来不关心Warning,只关心Error”
      

  6.   

    就是config.web文件夹里的代码啊
      

  7.   

    我新建了一个config.aspx,然后就把代码打上去了,但是好多个警告
      

  8.   

    config是后缀为.config的文件,不是你起个名字叫config它就是config了,你在你新建的项目中找找Web.config这个文件
      

  9.   

    哦,了解了,呵呵。
    但是,我应该将这些代码加到web.config里面的哪个具体位置呢?直接放到里<configSections>……</configSections>里么??书上的代码如下:
             <? xml version = "1.0" standalone ="yes" ?>
            <configuration>
              <appSettings>
               <add key = "页站名称" values = "莹莹的留言板" />
               <add key = "网站地址" values = "http://www.uestc.edu.cn" />
               <add key = "数据库路径" values = "db\data.mdb" />
               <add key = "每页显示留言数" value = "6" />
               <add key = "管理员密码" value = "admin" />
              </appSettings>
              <system.web>
                <globalization fileEncoding  = "gb2312" requestencoding = "gb2312" esponseencoding = "gb2312" />
                <trace enabled = "true" />
                <compilation defaultLanguage = "C#" debug = "true" />
              </system.web>
            </congfiguration>
      

  10.   

    你所创建的项目时.NetFramework2.0版本还是3.5版本的,如果是2.0版本的话,可以把web.config文件里面的代码删干净在把书上的代码全部复制到Web.config文件里,如果是3.5版本的话,就取<appSettings>
      <add key = "页站名称" values = "莹莹的留言板" />
      <add key = "网站地址" values = "http://www.uestc.edu.cn" />
      <add key = "数据库路径" values = "db\data.mdb" />
      <add key = "每页显示留言数" value = "6" />
      <add key = "管理员密码" value = "admin" />
      </appSettings>
    这一段放到<system.web>上面一行
      

  11.   

      <system.web>
      <globalization fileEncoding = "gb2312" requestencoding = "gb2312" esponseencoding = "gb2312" />
      <trace enabled = "true" />
      <compilation defaultLanguage = "C#" debug = "true" />
      </system.web>
      </congfiguration>
    那这一段放在哪儿呢?
      

  12.   

    还有一个小白问题,就是<script>……</script>段  要放在<body>……</body>里,还是放在<html>……</html>外面啊? 请大侠不吝赐教,感激涕零
      

  13.   

    3.5版本这一段就不用要了,script一般放在title标签下面body标签上面(个人习惯)
      

  14.   

    你从书上抄的这段内容应该放到Web.config文件中。
      

  15.   

    大侠,你QQ多少啊?我干脆加你QQ好友,请教请教您算了,我太菜了,实在是菜的不能再菜了。
      

  16.   

    而且还有一个错误提示:
    “各个节在每个配置文件中只能出现一次。有关异常的信息,请参阅帮助主题 <location>。”
    这是我按照那位你说的方法,把<appSettins>……</appSettings>这一段放到<system.web>……<system.web>后,运行,就出现这么一个错误。怎么办啊?高手,求解释啊。     另外,求 QQ 啊,高人。
      

  17.   

    说错了,是把<appSettins>……</appSettings>这一段放到<system.web>……<system.web>前,运行,仍然有一个错误。高手,留下您的 QQ 啊,求您了。
      

  18.   

    还有高人在线么???
    我要把下面这段代码加到web.config文件里,应该怎么加才不会出错啊?
    代码如下:
      <? xml version = "1.0" standalone ="yes" ?>
      <configuration>
      <appSettings>
      <add key = "页站名称" values = "莹莹的留言板" />
      <add key = "网站地址" values = "http://www.uestc.edu.cn" />
      <add key = "数据库路径" values = "db\data.mdb" />
      <add key = "每页显示留言数" value = "6" />
      <add key = "管理员密码" value = "admin" />
      </appSettings>
      <system.web>
      <globalization fileEncoding = "gb2312" requestencoding = "gb2312" esponseencoding = "gb2312" />
      <trace enabled = "true" />
      <compilation defaultLanguage = "C#" debug = "true" />
      </system.web>
      </congfiguration>
    我用的是VS2008,.net framework 3.5。
      

  19.   

    <?xml version="1.0" encoding="utf-8"?><!-- 
        
    encoding="utf8"设置编码格式utf8
    注意: 除了手动编辑此文件以外,您还可以使用 
        Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
         “网站”->“Asp.Net 配置”选项。
        设置和注释的完整列表在 
        machine.config.comments 中,该文件通常位于 
        \Windows\Microsoft.Net\Framework\v2.x\Config 中
    -->
    <configuration>
        <configSections>
          <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
              <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
              <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
                <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
              </sectionGroup>
            </sectionGroup>
          </sectionGroup>
        </configSections>
      <appSettings>
        <add key="FCKeditor:BasePath" value="~/fckeditor/"/>    <add key="FCKeditor:UserFilesPath" value="~/Files/" />  </appSettings>

        <connectionStrings/>
        <system.web>
            <!-- 
                设置 compilation debug="true" 可将调试符号插入
                已编译的页面中。但由于这会 
                影响性能,因此只在开发过程中将此值 
                设置为 true。
            -->
            <compilation debug="false">          <assemblies>
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
              </assemblies>        </compilation>
            <!--
                通过 <authentication> 节可以配置 ASP.NET 用来 
                识别进入用户的
                安全身份验证模式。 
            -->
            <authentication mode="Windows" />
            <!--
                如果在执行请求的过程中出现未处理的错误,
                则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
                开发人员通过该节可以配置
                要显示的 html 错误页
                以代替错误堆栈跟踪。        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->
          <pages>
            <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"/>
            </controls>
          </pages>      <httpHandlers>
            <remove verb="*" path="*.asmx"/>
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
          </httpHandlers>
          <httpModules>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          </httpModules>
        </system.web>    <system.codedom>
          <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
                      type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
              <providerOption name="CompilerVersion" value="v3.5"/>
              <providerOption name="WarnAsError" value="false"/>
            </compiler>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
                      type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
              <providerOption name="CompilerVersion" value="v3.5"/>
              <providerOption name="OptionInfer" value="true"/>
              <providerOption name="WarnAsError" value="false"/>
            </compiler>
          </compilers>
        </system.codedom>
        
        <!-- 
            在 Internet 信息服务 7.0 下运行 ASP.NET AJAX 需要 system.webServer
            节。对早期版本的 IIS 来说则不需要此节。
        -->
        <system.webServer>
          <validation validateIntegratedModeConfiguration="false"/>
          <modules>
            <remove name="ScriptModule" />
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          </modules>
          <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="ScriptHandlerFactory" />
            <remove name="ScriptHandlerFactoryAppServices" />
            <remove name="ScriptResource" />
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
                 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </handlers>
        </system.webServer>    <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
              <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
              <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
              <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
            </dependentAssembly>
          </assemblyBinding>
        </runtime>
    </configuration>上面的代码是.net framework 3.5中web.config文件的全部内容,注意红色的部分;<appSettings>看好位置,你研究下吧
      

  20.   

    这是2.0的web.config文件的全部内容,你研究下,有不懂的在问
    <?xml version="1.0"?>
    <!-- 
        注意: 除了手动编辑此文件以外,您还可以使用 
        Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
         “网站”->“Asp.Net 配置”选项。
        设置和注释的完整列表在 
        machine.config.comments 中,该文件通常位于 
        \Windows\Microsoft.Net\Framework\v2.x\Config 中
    -->
    <configuration>
    <appSettings>
    <add key="Fuck" value="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Pogare;Data Source=."/>
    </appSettings>
    <connectionStrings/>
    <system.web>
    <!-- 
                设置 compilation debug="true" 可将调试符号插入
                已编译的页面中。但由于这会 
                影响性能,因此只在开发过程中将此值 
                设置为 true。
            -->
    <compilation debug="true">
    </compilation>
    <!--
                通过 <authentication> 节可以配置 ASP.NET 用来 
                识别进入用户的
                安全身份验证模式。 
            -->
    <authentication mode="Windows"/>
    <!--
                如果在执行请求的过程中出现未处理的错误,
                则通过 <customErrors> 节可以配置相应的处理步骤。具体说来,
                开发人员通过该节可以配置
                要显示的 html 错误页
                以代替错误堆栈跟踪。        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>
            -->
    </system.web>
    <system.codedom>
    </system.codedom>
    <!-- 
            在 Internet 信息服务 7.0 下运行 ASP.NET AJAX 需要 system.webServer
            节。对早期版本的 IIS 来说则不需要此节。
        -->
    <system.webServer>
    </system.webServer>
    </configuration>