版主:
请帮下忙呀!
按书本的例子:现有两个文件
Default.aspx
其源代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="test.example1" %>
<!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">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label" Width="198px"></asp:Label><br />
<asp:Label ID="Label2" runat="server" Text="Label" Width="44px"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Width="144px"></asp:TextBox><br />
<asp:Label ID="Label3" runat="server" Text="Label" Width="42px"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" Width="146px"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" /></div>
</form>
</body>
</html>
Default.aspx.cs
其源代码如下:
using System;
using System.Data;
using System.Configuration;
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 test
{
public partial class example1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text.Trim() != "")
{
Response.Write("welcome<b>" + TextBox1.Text + "</b>use this system!<br>");
Response.Write("the password you input is:" + TextBox2.Text + "<br><br>");
}
else Response.Write("please input username and password!!!<br>");
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
}
}
}
现用csc /t:library /out ds.dll Default.aspx.cs 编译得到ds.dll文件,然后把Default.aspx 拷到iis指向的程序目录下,把ds.dll拷到该目录下的新建的文件夹bin下,浏览器上键入127.0.0.1,出现如下错误提示:
分析器错误信息: 文件“/Default.aspx.cs”不存在。
行 1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="test.example1" %>
行 2:
行 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
请问是什么原因?不是说编译好了.dll文件,运行就不用.cs文件了吗?谢谢