Monday, March 29, 2010

What does CLR stand for?

CLR stands for Common Language Runtime. The CLR manages the execution of code in the .NET Framework. Traditionally source code would be compiled directly into machine specific code. This meant that different executables needed to be created for different architectures. In the .NET Framework, source code is compiled into an intermediate form. This layer of abstraction allows for a compile once, run on many architectures methodology.

Besides offering a layer of abstraction from the specific hardware architecture, the CLR also provides additional services that are common in computing environments.
  • Garbage Collection
  • Exception Handling
  • Security

Additional Resources
Common Language Runtime (Wikipedia)
Common Language Runtime Overview (Microsoft)

What is metadata?

In the context of the .NET Framework, metadata is descriptive information about an application. Metadata tells what the application can do, where it belongs and so forth.

Additional Resources
.NET metadata (Wikipedia)

What are the programmatic improvements of ASP.NET over ASP?

When Microsoft moved from ASP to ASP.NET they had a chance to closely integrate ASP.NET with advancements they had made in the .NET Framework. (As opposed to "bolting" on a server side language after the fact)

With that tighter integration came significant programmatic improvements from ASP.NET over ASP.

Ease of Deployment
The introduction of metadata means that one no longer has to register web applications or COM objects. With this metadata the .NET Framework is able handle the details of running an application on your behalf.

Easier More Powerful Session Management
The web is based on an inherently stateless protocol (HTTP). Measures need to be taken to provide "statefulness" to web transactions. (If you added an item to a shopping cart you wouldn't want the web server to forget who you are when you request the next page) Classic ASP had session management, but that session management did not scale to web farm server environments. ASP.NET addressed this issue, opening more possibilities for robust technology offerings.

Code Declaration Blocks
Code declaration blocks are compiled instead of being interpreted at run time. This compilation allows for much better performance. Code declaration blocks also provide a mechanism to separate HTML and scripting content. This important because it helps code be more readable and maintainable. (The job is never done when the code is finished, someone will ALWAYS have to maintain it later)

There are several other advantages that you can read about in the Additional Resources section.

Additional Resources
ASP.NET vs ASP (W3Schools)

How does ASP.NET work with the client and server machines?

ASP.NET allows on to deliver dynamic content such as information collected from a database. ASP.NET does this by working with both the server (the source of the content) and the client (the consumer of the content).

ASP.NET on the Server
When a page is requested, the contents of the page are first examined and any code that is found is executed before honoring the request. This includes operations like processing forms and collecting data to display from databases.

ASP.NET on the Client
Code that is executed on the server inserts special client side code in the page that it returns. This allows the server to monitor what events are occurring on the client.

Additional Resources
ASP.NET 2.0's Client Call Back Feature (DotNetJunkies)

Why can't you simply double click on an ASP.NET page to run it?

An ASP.NET file must be processed by the server and have all code blocks executed before it can be used. The server knows how to process a request based on rules that are set regarding a list of file types. In the case of a server with the .NET SDK installed, the server knows that the .NET Framework will be used to process files with a .aspx extension.

It is also important to understand that what you see as a developer (such as script blocks that are intended to be run on the server) are not seen in the HTML that is delivered to the user. So in other words users do not get to see the inner workings that went into creating a page, they only get to see the end result. This would not be possible if the server did not first process all the server code and produce HTML from that server code.

What is a virtual directory?

A virtual directory is a folder that can be accessed as though it were in the www root of a web server.

Advantages of a virtual directory include:
  • Simplified URLs
  • Increased security
  • Ability to change file locations without changing the web address

Additional Resources
How to create a virtual directory (Microsoft)

What is the difference between code declaration blocks and render blocks?

The main difference between code declaration blocks and render blocks is compilation. Code render blocks are not compiled. Because they are not compiled they are not as efficient as code declaration blocks.

This really comes into play when you consider the situation where 1000 people are going to view your ASP.NET page. For code declaration blocks, the code only needs to be compiled once the first time the page is requested. From then on the compiled code can be quickly used in subsequent requests. With code render blocks, they must be processed for EVERY request that is made. That response time adds up over many requests and also places additional load on the server. More load equals decreased response time, which is bad news when you are delivering web content. When was the last time you waited more than a few seconds for a web page to load?

Additional Resources
Code declaration blocks (Microsoft)
Code render blocks (Microsoft)