//HelloWorld.aspx
<%@ Page language="c#" Codebehind="HelloWorld.aspx.cs" Inherits="sample.WebForm1"  %>
<HTML>
<body>
<form id="Form1" method="post" runat="server">
  <center>
<asp:Label id="my" runat="server" Font-Size="30">Hello  World</asp:Label>
  </center>
</form>
</body>
</HTML>//HelloWorld.aspx.cs
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace sample
{

public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;

public WebForm1()
{
Page.Init += new System.EventHandler(Page_Init);
} private void Page_Load(object sender, System.EventArgs e)
{
// 加入页面加载时需要处理的代码
} private void Page_Init(object sender, EventArgs e)
{
InitializeComponent();
}
private void InitializeComponent()
{    
this.Load += new System.EventHandler(this.Page_Load);
}
}
}
怎么会提示
Parser Error Message: Could not load type 'sample.WebForm1'.
是不是我的设置有问题啊

解决方案 »

  1.   

    就是为什么不能引入
    <%@ Page language="c#" Codebehind="HelloWorld.aspx.cs" Inherits="sample.WebForm1"  %>
      

  2.   

    这不是.net环境生成的代码,你去看看它生成的就明白了
      

  3.   

    打開你的項目,再
    Ctrl + Shift + B編譯一次.
      

  4.   

    呵呵,应该是你没有创建应用程序的问题.
    你先在IIS中创建应用程序试之.当然,你也必须在Vs.net生成应用程序哦.
      

  5.   

    我创建了虚拟路径
    文件都放在那里
    如果有c#的代码放在.aspx文件里是可以运行的
    但是放在.cs 文件下就出现这种错误
      

  6.   

    Codebehind="HelloWorld.aspx.cs" 
    =============>
    Codebehind="WebForm1.aspx.cs"
      

  7.   

    要编译一次就OK了~
    在"运行/生成解决方案"..运行一次就OK了~~~
      

  8.   

    确认一下你的项目的名字是不是sample 如果不是的话就建一个项目 名字取为sample
      

  9.   

    用Csc编译.cs文件为.dll
    然后将.dll拷贝到你的应用程序的根目录下的BIN/目录下.
    然后就可以在.aspx文件中引用.dll了.
    <%@ Page language="c#" Inherits="sample.WebForm1" %>
      

  10.   

    没有将cs编译成dll,没有ide的话也可以把代码直接写在aspx文件里,就不用编译了。