200分:ASP.NET页面被服务器直接返回,请问各位大侠是怎么回事?
使用C#进行开发,aspx文件内容如下
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TestWeb2.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.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 MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体" id="FONT1">
<asp:Label id="lblDisplay" style="Z-INDEX: 101; LEFT: 96px; POSITION: absolute; TOP: 61px" runat="server" Width="319px" Height="14px"></asp:Label>
<asp:Button id="btnTrigger" style="Z-INDEX: 102; LEFT: 456px; POSITION: absolute; TOP: 58px" runat="server" Width="148px" Height="29px" Text="Display"></asp:Button>
<asp:Label id="Label1" style="Z-INDEX: 103; LEFT: 181px; POSITION: absolute; TOP: 149px" runat="server" Width="278px" Height="15px">Label</asp:Label></FONT>
</form>
</body>
</HTML>
cs文件如下
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace TestWeb2
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblDisplay;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button btnTrigger;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnTrigger.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
lblDisplay.Text = "Hello, world!";
}
}
}