asp.net runtime understanding

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

I read in a book and the text say the following.
"Let's look at a typical Web request from a browser to show how the ASP.NET
runtime goes into action. The client request a file, for example
default.aspx from the server. All ASP.NET Web pages usually have the file
extension .aspx. Because this file extension is registered with IIS, or
known by the Visual Web Devepoper Web server, the ASP.NET runtime and the
ASP.NET worker process get into the picture. With the first request to the
file default.aspx, the ASP.NET parser is started, and the compiler compiles
the file together with a C# file that is associated with the .aspx file and
creates an assembly.
Then the assembly is compiled to native code by the JIT compiler of the
..NET runtime. The assembly contains a Page class that is invoked to return
HTML code to the client. then the Page object is destroyed. However, the
assembly is kept for the next request, so with the second request is is not
decessary to compile the assembly again."

What I have some difficulty to understand is the connection between the
assembly that is mentioned at the end in the above text
and the code that I can debug on the server. ?
I mean the code in code behind file.

//Tony
 
I read in a book and the text say the following.
"Let's look at a typical Web request from a browser to show how the ASP.NET
runtime goes into action. The client request a file, for example
default.aspx from the server. All ASP.NET Web pages usually have the file
extension .aspx. Because this file extension is registered with IIS, or
known by the Visual Web Devepoper Web server, the ASP.NET runtime and the
ASP.NET worker process get into the picture. With the first request to the
file default.aspx, the ASP.NET parser is started, and the compiler compiles
the file together with a C# file that is associated with the .aspx file and
creates an assembly.
Then the assembly is compiled to native code by the JIT compiler of the
.NET runtime. The assembly contains a Page class that is invoked to return
HTML code to the client. then the Page object is destroyed. However, the
assembly is kept for the next request, so with the second request is is not
decessary to compile the assembly again."

What I have some difficulty to understand is the connection between the
assembly that is mentioned at the end in the above text
and the code that I can debug on the server. ?
I mean the code in code behind file.

Look at it graphically:

foobar.aspx--(ASP.NET)--><random name>.cs--|
|--(C# compiler)--><random
name>.dll--(JIT)-->native code in memory
foobar.aspx.cs-----------------------------|

The assembly is produced from foobar.aspx and foobar.aspx.cs!

Arne
 
Arne Vajhøj said:
Look at it graphically:

foobar.aspx--(ASP.NET)--><random name>.cs--|
|--(C# compiler)--><random
name>.dll--(JIT)-->native code in memory
foobar.aspx.cs-----------------------------|

The assembly is produced from foobar.aspx and foobar.aspx.cs!

Arne

Ok the assembly is created from the .aspx file and the code behind file but
when I for example debug on the server side is it this assembly that I debug
then ?

//Tony
 
Ok the assembly is created from the .aspx file and the code behind file but
when I for example debug on the server side is it this assembly that I debug
then ?

In general: the code in the assembly will be executed and
the debugger will display the source code matching the code
being executed.

I assume ASP.NET to follow the general model even though I
have never tried.

Arne
 
Arne Vajhøj said:
In general: the code in the assembly will be executed and
the debugger will display the source code matching the code
being executed.

I assume ASP.NET to follow the general model even though I
have never tried.

Arne

I just wonder where is this assembly located that consist of the aspx file
and the code behind file ?
This file must be saved somewhere on disk I assume.

//Tony
 
I just wonder where is this assembly located that consist of the aspx file
and the code behind file ?
This file must be saved somewhere on disk I assume.

Yes.

You can ask ASP.NET where they are.

Try make a one line .aspx with:

<%=System.Reflection.Assembly.GetExecutingAssembly().Location%>

Arne
 
Arne Vajhøj said:
Yes.

You can ask ASP.NET where they are.

Try make a one line .aspx with:

<%=System.Reflection.Assembly.GetExecutingAssembly().Location%>

Arne

I found it and used Red Gats Reflector to look into the DLL assembly but it
was not so very interesting
I found the class that I have in the code behind file and so on.

//Tony

//Tony
 
I found it and used Red Gats Reflector to look into the DLL assembly but it
was not so very interesting
I found the class that I have in the code behind file and so on.

It should have all the code you are executing. Well - most of
the functionality is probably in System.Web classes.

Arne
 
Arne Vajhøj said:
It should have all the code you are executing. Well - most of
the functionality is probably in System.Web classes.

Arne

yes all the code was there.

//Tony
 
Back
Top