error ?  show more info

解决方案 »

  1.   

    webform1.aspx
    <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="hello.WebForm1" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <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">
    <h1>DllTest - Ex3(例3)</h1>
    <hr>
    <asp:label runat="server" id="NoteLabel" style="FONT-WEIGHT:bold; COLOR:red" />
    <input runat="server" id="f_Name" size="8" NAME="f_Name"> <button runat="server" onserverclick="OnNameSubmit" ID="Button1" type="button">
    确定</button>
    <asp:Button id="Button2" runat="server" Text="OnClick"></asp:Button>
    </form>
    </body>
    </HTML>WebForm1.aspx.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 hello
    {
    /// <summary>
    /// WebForm1 的摘要说明。
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Label NoteLabel;
    protected System.Web.UI.HtmlControls.HtmlInputText f_Name;
    protected System.Web.UI.WebControls.Button Button2;
    protected System.Web.UI.HtmlControls.HtmlButton Button1;

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    if( !IsPostBack ) NoteLabel.Text = "请输入您的姓名:";
    } protected void OnNameSubmit(Object src, EventArgs args)
    {
    string name = f_Name.Value;

    NoteLabel.Text = (name=="") ? "姓名不能为空" : name +",您好。欢迎光临!";
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion
    }
    }在加了webform1.aspx文件加入<script runat=server>123123</script>
    后的到aspx的编译文件
    文件里多加了(比vs2002)
    protected ASP.Global_asax ApplicationInstance {
                get {
                    return ((ASP.Global_asax)(this.Context.ApplicationInstance));
                }
            }
    注释后可编译,按照文章的方法,报错
      

  2.   

    源文件
    http://220.163.11.52/hello.rar