Introduce new filetype with httphandler

G

Guest

Hi!

I want my web application to be able to handle files with the extension
..mspx (my own extension). The new extension should be handled exatly the way
aspx files are handled, but with some additional code specific to the .mspx
extension files.

I thought this would be an easy task, but maby I've cornored myself into a
wrong path. I've set the mapping correct in IIS, so that asp.net manages the
new extension. I've also created a class that inherits from the IHttpHandler
interface. This custom HttpHandler is also registered in web.config.

So far so good, but I've not figured out how to implement the content of the
custom HttpHandler, so that it first goes throuht my custom code, and then
let the Page class handle the rest.

Any ideas?

Thanx!
Paul
 
B

Brock Allen

You can try Server.Transfer to process the ASPX page. Depending upon what
you need to do, you could instead implement IHttpHandlerFactory and do what
you need to in GetHandler, then delegate to the built in PageHandlerFactory.
Or from your HttpHandler simply call into PageHandlerFactory to get the ASPX
handler then call its ProcessRequest directly.
 
B

Bruce Barker

if you your handler wants the normal process, it has to call it. there is
only one handler per request. look at httpmodules, this may be what you want
instead. if you want to call asp,net to process the message, you must create
the asp.net page handelr yourslf, and call it. see
PageParser.GetCompilerPageInstance(), which returns a handler you can call.

-- bruce (sqlwork.com)
 
G

Guest

Thanx, I already solved the problem using
PageParser.GetCompilerPageInstance() (as you also sugested).
I hope there are no performence downsides or any other downsides for that
matter using this method.
 
G

Guest

I solved the problem using the PageParser.GetCompilerPageInstance() method.
I hope there are no performence downsides or any other downsides for that
matter using this method.

Thanx alot!
 

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,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top