ASP.NET request lifecycle confusion
Asked Answered
E

5

1

I am new to C# and .Net and am coming from a Java background. I am trying to get my head around the .NET way of doing web applications and am not having much luck.

I want to build an application to handle requests urls and write responses that return images. Having only used Java servlets in the web application field I am after some good resources and/or explanations on handling the request side of the application.

How are requests handled? and with what Objects? What is the cycle? how do pages function around this?

These are basic broad questions so if anyone knows of resources that covers them all thoroughly please let me know. What I have found so far has bits of information not the overall picture.

Effortless answered 29/5, 2009 at 4:45 Comment(3)
Is this question too broad? I feel like linking to lmgtfy.com. How could the first 10 results of this query ( google.com/search?q=.net+page+lifecycle ) be not detailed enough?Manet
hmm...I know what you mean jfar, but I remember not even knowing where to start when I started .NET. For example, notice your google query contains "page lifecycle", whereas jmioh's question contains "request lifecycle." This is because, for someone not familiar with .NET, its not obvious that the Page Class itself is so involved with the HTTP requests. that's why I've also include info on how ASP.NET can handle HTTP calls in different ways, but how the Page is the default way.Periscope
Exactly. The reason I asked is because for my needs, I am going to be going nowhere near a page, and all the resources I found WERE about page life cycles and server controls. HttpHandler is what I will be using. Thanks for your help guys.Effortless
G
8

The overall page cycle is complex - but for serving images, you may want to look primarily at the IHttpHandler interface - or (more simply) create a "generic handler" (.ashx file). The IHttpHandler is the simplest "request/response" setup, without the burden of .aspx pages; you simply read from the context.Request, and write to the context.Response.

Galactometer answered 29/5, 2009 at 5:2 Comment(0)
W
2

FOr serving up just image have a look HttpHandlers.

As for Page life cycles: I love this image: EggHeadCafe
(source: eggheadcafe.com)

Weep answered 27/7, 2009 at 19:15 Comment(0)
P
1

This overview will explain the Page life cycle, Page (an ASPX page) being the default HTTP handler in ASP.NET.

But there are other ways to handle HTTP calls. This resource will explain how .NET can handle HTTP calls, and how ASPX Pages handle them by default.

cheers

Periscope answered 29/5, 2009 at 5:6 Comment(2)
Technically it isn't really the "default" handler; simply, it is one you see most-commonly with aspx-based sites. The "default" (looking at the master web.config) is the aptly-named System.Web.DefaultHttpHandler; it looks like this mainly handles static content, but I didn't look in too much detail.Galactometer
oh. damn. sigh. yeah you're right, I wanted to clear up for jimioh the link between request handlers and the Page object in ASP.NET. Thanks thoughPeriscope
A
0

This is a good place to start for a description of the page lifecycle.

For your other questions, I'd actually recommend you get a book and sit back for a few hours with it. Programming ASP.NET 2.0 Core Reference has proved itself very valuable.

Adeno answered 29/5, 2009 at 4:54 Comment(0)
A
0

The site asp.net contains a lot of information to get you started. A good starting point is the learning section.

MSDN has lots of information, of course. A couple articles and pages you may find interesting: - ASP.NET Page Lifecycle Overview - Creating ASP.NET Web Pages

When reading the texts on MSDN, check the tree structure to the left for more content.

Actual answered 29/5, 2009 at 4:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.