purpose of handler (.ashx) in asp.net...

Posted by Gopal_nivas under ASP.NET on 8/17/2009 | Views : 75630 | Status : [Member] | Replies : 6
hi..

what is the purpose of handler file(.ashx) in asp.net..

explain with examples..

need ur suggestions...

regards

gopal.s




Responses

Posted by: Santosh.impossible on: 9/21/2010 [Member] Starter | Points: 25

Up
0
Down
Follwing are some of uses of handler file(.ashx) in asp.net:

1. Apply security mechanism,
2. URL rewriting,
3. Filter something in the request that is send to IIS.

Please let me know if you know any more uses of .ashx file.

Thanks & Regards,
Santosh


santosh kumar patro

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakshmanan.t on: 1/9/2011 [Member] Starter | Points: 25

Up
0
Down
You want to create an ASP.NET file that is not a typical web forms page. Your file will need to dynamically return an image from a query string, or XML and other non-HTML web pages.
it's usually much more convenient to generate a simple handler than it is to create a whole new assembly to handle the request. Second, you don't need to run interference with either Web.Config or with IIS. That is, Web.Config and IIS already understand what to do about files with the extension of .ashx. Installing ASP.NET places those when mapping into IIS.

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/9/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Go through the below link... it explains the handlers in asp.net in detail

http://www.c-sharpcorner.com/uploadfile/civa_kumar2000/httphandlersinasp.net11282005003115am/httphandlersinasp.net.aspx

Thanks
Karthik
www.f5Debug.net

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chiragkanzariya on: 10/16/2012 [Member] Starter | Points: 25

Up
0
Down
An ASHX handler allows you a discrete http handler without the overhead of processing a page request (an ASPX file).

For Example you can check my blog http://chiragkanzariya.blogspot.com/2012/10/ashx-handler-in-aspnet.html

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja on: 8/17/2009 [Member] Starter

Up
0
Down
Please go through following link and you will get all required details with an example.

http://dotnetperls.com/ashx-handler

Thanks

Regards,
Raja, USA

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rtpharry on: 8/21/2009 [Member] [MVP] Bronze

Up
0
Down
By far the most common example I point people to a File Handler.

This lets you store your files in a safe location and serve them up through a controlled environment.

Why would you want to do this? Well you might want to only allow the file owner or an authenticated user to get access.

In order to prevent name clashes with the files stored on the server you might need to rename such as adding a guid to give them a unique name. The file handler would let you serve up the file as if it had the original, clean name.

Now that I have gone on about file handlers for long enough I should show you my link that I roll out in situations like these:

http://blogs.msdn.com/petel/archive/2005/12/01/499189.aspx

This is just one use for an ashx. You can serve any combination of html, images, binary that you require.

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response