Friday, September 4, 2009

What exactly happens when ASPX page is requested from Browser


Following are the steps which occur when we request a ASPX page :-
* The browser sends the request to the webserver.let’s assume that the webserver
at the other end is IIS.
* Once IIS receives the request he looks on which engine can serve this request.
When I mean engine means the DLL who can parse this page or compile and
send a response back to browser. Which request to map to is decided by file
extension of the page requested.
Depending on file extension following are some mapping
* .aspx, for ASP.NET Web pages,
* .asmx, for ASP.NET Web services,
* .config, for ASP.NET configuration files,
* .ashx, for custom ASP.NET HTTP handlers,
* .rem, for remoting resources
* Etc
You can also configure the extension mapping to which engine it can route by using the
IIS engine.

Example a ASP page will be sent to old classic ASP.DLL to compile. While .ASPX pages
will be routed to ASP.NET engine for compilation.
* As this book mainly will target ASP.NET we will look in to how ASP.NET
pages that is ASPX pages generation sequence occurs. Once IIS passes the
request to ASP.NET engine page has to go through two section HTTP module
section and HTTP handler section. Both these section have there own work
to be done in order that the page is properly compiled and sent to the IIS.
HTTP modules inspect the incoming request and depending on that they can
change the internal workflow of the request. HTTP handler actually compiles
the page and generates output. If you see your machine.config file you will see
following section of HTTP modules



type="System.Web.Security.WindowsAuthenticationModule" />
type="System.Web.Security.FormsAuthenticationModule" />
type="System.Web.Security.PassportAuthenticationModule" />
type="System.Web.Security.UrlAuthorizationModule" />
type="System.Web.Security.FileAuthorizationModule" />
>

The above mapping shows which functionality is handled by which Namespace. Example
FormsAthuentication is handled by “System.Web.Security.FormsAuthenticationModule”.
If you look at the web.config section HTTP module is where authentication and
authorization happens.
Ok now the HTTP handler is where the actual compilation takes place and the output is
generated.Following is a paste from HTTP handler section of WEB.CONFIG file.







...

* Depending on the File extension handler decides which Namespace will
generate the output. Example all .ASPX extension files will be compiled by
System.Web.UI.PageHandlerFactory
* Once the file is compiled it send back again to the HTTP modules and from
there to IIS and then to the browser.

Share This!


5 comments:

Anonymous said...

I wish not acquiesce in on it. I over polite post. Particularly the designation attracted me to read the unscathed story.

Anonymous said...

Nice fill someone in on and this post helped me alot in my college assignement. Say thank you you for your information.

Anonymous said...

Opulently I assent to but I dream the brief should prepare more info then it has.

Anonymous said...

Great post, I've been looking for something like that.

-Yours Truly,
Johanna

Rajesh Rolen said...

Thanks Johanna. Your kind of people encourage me to write.

Thanks a lot
Rajesh Kumar Rolen
www.DotNetAcademy.blogspot.com

Powered By Blogger · Designed By Seo Blogger Templates