Category Archives: ASP.NET

ASP.NET Internals: Viewstate, Page Life Cycle, and Request Architecture

Most developers are familiar with the high level abstractions that ASP.NET provides for them, such as Web Forms and Web Services. However, below these abstractions sits a very interesting architecture. Knowing the under works of this architecture not only elevates the ASP.NET developer into the advanced zone, but also helps him or her, write better designed applications and solve advanced problems that occur way below the high level ASP.NET use.

Do you know what happens before a page starts executing its events? Do you know how the ASP.NET pipeline works and what are the best practices for your code to subscribe to this pipeline? Do you know the importance of ViewState in the page lifecycle beyond the “it saves page state between postbacks” statement? If the answer of any of the above questions is no, then you will benefit from my pluralsight course:

Parallel Task with ASP.NET HttpContext

When using .NET 4.0 Parallel Programming (Check my article) with ASP.NET, you will lose HttpContext once you jump in to another task.
In my case I wanted to get hold of the context from which I wanted to get the current page handler. So I came up with the below code.HOWEVER, and as you can see this is BIG HOWEVER, although I tried the code and it did work I am not 100% sure about it because the idea of manually setting the context (as you will see in a moment) and messing up with the way threading works gives me the creeps! But anyway I thought I would share it: Continue reading