0

http://myfileserver/images/car/chevrolet.gif

I have this file server holding the files such as images, doc files etc. Now i want to intercept the http request and based on the file extension i want perform some action such as redirection to some other webpage.

What is the best and the easier way to accomplish this thing? I am using asp.net framework for my applications.

Pls suggest the approach.

Thx

Karan
  • 3,265
  • 9
  • 54
  • 82

2 Answers2

1

If you are looking to intercept the request for specific file types, then go with an Http Handler. Here is the MSDN link explaining their usage - Http Handlers

Zensar
  • 817
  • 4
  • 8
0

In the WCF world if you're looking to handle an HTTP request with a different option based on the requested filetype, you may want to look into adding an IDispatchOperationSelector, which allows the service to route the code through a different operation. The default HTTP implementation is the WebHTTPDispatchOperationSelector, which is explained pretty well here and here.

If you want to remain in the Asp.Net world, I'd recomend going with custom message handlers. Here's an article by Mike Wasson explaining how these work & where they fall in the Asp stack.

Chris
  • 2,885
  • 18
  • 25
  • i haven't decided yet to use WCF. If something else is easy and simple, i heard that MS Web API is quick for such things.. But i do not know how to use it.. – Karan Oct 25 '12 at 15:06
  • just added an edit containing some information about the MS Web API version of OperationSelectors – Chris Oct 25 '12 at 15:39