ASP.NET with ashx files

R

Roshawn Dawson

Hi,

Has anybody created an entire asp.net app using only ashx files? I know that they are simply
handlers used by the asp.net worker process. I hear that they are in some respects better than
using aspx files because they don't have to be compiled and don't need any page processing.

As an experiment, I'm creating an affiliate site that will use ashx files mainly. During testing I
haven't noticed anything different other than it seems to run slightly faster. But there are many
unknowns. What security issues are there with ashx files? Any gotchas to be aware of?

Thanks,
Roshawn
 
L

Lau Lei Cheong

The statement about "ASHX is better than ASPX because it don't need
compile..." is wrong.

ASPX files can use no code-behind using inline style (i.e.: something like
<script language="vb\c#" runat="server"></script>), and sometimes header
file need to be compiled too if they have code-behind.

P.S.: FYI in ASP.NET 2.0 you can choosing to compile-on-the-fly even if
you're using code-behind.
 
R

Roshawn Dawson

Hmmm... that's something that needs to be considered. It never crossed my mind that inline scripts
in asp.net could in fact be better than ashx files as no one has ever compared the two.

Thanks Lau. :)
 
S

Scott Allen

ASHX files are great for specific tasks, and a quick look for ASHX on
a search engine will show how people are using HttpHandlers.

As for building an entire site - I 'd be hesitant to try.
Constructing a UI for the end user will be a very raw and low level
experience in an ASHX file. You won't have declarative programming
with the ASP.NET server controls, and productivity will take a
nosedive.
 
B

Bruce Barker

ashx pages need to be compiled just like an aspx page. the difference is the
processing. an aspx page runs thru the page life cycle calling the page
events, the ashx has fewer events.

ashx pages are fine if you want to handle the postback logic yourself, and
generate mostly html controls. perfect if you are using xlst for html
rendering.

-- bruce (sqlwork.com)
 
R

Roshawn Dawson

Hi guys,

I've read your replies and am pleased with your knowledge.

Scott Allen said:
"As for building an entire site - I 'd be hesitant to try. Constructing a UI for the end user will
be a very raw and low level experience in an ASHX file. You won't have declarative programming with
the ASP.NET server controls, and productivity will take a nosedive."

I hear you, Scott. In my situation server controls aren't used at all. As for declarative
programming there is a simple, albeit nagging solution. I write all my code in a class file. That
way I get the declarative programming necessary to make things work. After testing the code I
simply copy and paste the code in the class file into the ashx file. Things work perfectly for me
this way. But keep in mind that I'm not using any server controls, so this technique may not be
suitable for all asp.net developers.

Bruce Barker, you hit the nail on the head. I'm simply using xml and xslt to render the output to
the browser. Html controls are being used. And because the ashx files don't run through the page
life cycle like an aspx file, it could be just a wee-bit faster. IMO, any speed improvement is
worth the extra effort if it doesn't compromise productivity.

Thanks guys!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top