"MS News (MS ILM)" <sq**********@hotmail.com> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl...
John,
What is the names class? can't find it
What is a named class? vs. un-named class? if any exist?
When using codebehind, you might have the following situation for
~/default.aspx.
In file default.aspx:
<%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false"
Inherits="Webproject1.default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>default</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>
<form id="default" method="post" runat="server">
<asp:Button id="Button1" runat="server" text="Button"
onclick="Button1_ClickHandler" />
</form>
</body>
</HTML>
In file default.aspx.cs:
namespace Webproject1
{
public class default : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
...
protected void Button1_ClickHandler(object sender, System.EventArgs
e)
{
// Do something because the button was clicked
Button1.Text = "Clicked!";
}
}
}
All the codebehind classes of the web project are compiled together to
produce a single assembly, in this case, bin\Webproject1.dll. When
default.aspx is requested, ASP.NET parses it and compiles it into what I
called an "anonymous" class. Actually, it uses a name like ASPX_default.
This class is declared like:
public class ASPX_default : Webproject1.default
{
}
because of the "Inherits" clause in the Page directive.
So the "anonymous" class inherits the "named" class (Webproject1.default)
from Webproject1.dll, which in turn inherits System.Web.UI.Page from
System.Web.dll.
On a request, an instance of class ASPX_default is created. Various methods
of this class and of its base classes (especially, of the Page class) are
executed during the lifetime of the request, and the final output is sent to
the client. When all that's done, the instance of ASPX_default is destroyed.
The next time the page is requested, a new instance of the ASPX_default
class will be created. If the page has been cached, then the cached output
will be sent and no new instance will be created.
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com