下面是我的一个小程序:
系统提示的错误是:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------分析器错误 
说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。 分析器错误信息: “clockexample.WebForm1”不扩展类“System.Web.UI.Page”,因此此处不允许。源错误: 
行 1:  <%@ Page Language="C#" AutoEventWireup="false" CodeBehind="WebForm1.aspx.cs" Inherits="clockexample.WebForm1 "%>
行 2:  
行 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
 源文件: /WebForm1.aspx    行: 1 
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.42; ASP.NET 版本:2.0.50727.42 
..........................................................................................
<%@ Page Language="C#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"  Inherits="clockexample.WebForm1"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"><html>
<head >
<title>What's the time?</title>
 <meta name="GENERATOR"content="Microsoft Visual Studio 2.0">
 <meta name="CODE_LANGUAGE"content="C#">
 <meta name="vs_defaultClientScript"content="Javascript">
 <meta name="vs_targetSchema"content="http://schemas.microsoft.com/intellisense/ie5">
 </head>
 <body>
 <form id="Form1" method="post" runat="server">
 <p>The time(according to the web server)is:
 <%=System.DateTime.Now %>
 </p>
 <p>What's the time on the web client?
 <input onclick="alert('web client time is now'+new Date());"
 type="button"value="Client Time"/>
 </p>
 </form>
 </body>
</html>
.......................................................................

解决方案 »

  1.   

    贴cs代码,估计你没继承page类
      

  2.   

      检查页面的命名空间和class的命名空间是不是一样,确保相同就OK了
      

  3.   

    大侠,我是刚开始学的菜鸟,你能告诉我在那贴嘛是不是在后台编码里,下面是后台代码
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;namespace WebApplication1
    {
        public partial class -default: System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {        }
        }
    }
    你能告诉我贴在那嘛?
      

  4.   

      检查页面的命名空间和class的命名空间是不是一样,确保相同就OK了
      

  5.   

    <%@ Page Language="C#" AutoEventWireup="false" CodeBehind="WebForm1.aspx.cs" Inherits="clockexample.WebForm1"%> namespace WebApplication1 

        public partial class -default: System.Web.UI.Page 
        { 
            protected void Page_Load(object sender, EventArgs e) 
            {         } 
        } 
    } 这两个地方不一致
      

  6.   

    建议改为
    <%@ Page Language="C#" AutoEventWireup="false" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1._default"%> namespace WebApplication1

        public partial class _default: System.Web.UI.Page 
        { 
            protected void Page_Load(object sender, EventArgs e) 
            {         } 
        }