Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Introduce new filetype with httphandler

Reply
Thread Tools

Introduce new filetype with httphandler

 
 
=?Utf-8?B?UGF1bA==?=
Guest
Posts: n/a
 
      06-15-2005
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
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      06-15-2005
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> 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




 
Reply With Quote
 
 
 
 
Bruce Barker
Guest
Posts: n/a
 
      06-15-2005
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)





"Paul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
=?Utf-8?B?UGF1bA==?=
Guest
Posts: n/a
 
      06-15-2005
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.


"Bruce Barker" wrote:

> 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)
>
>
>
>
>
> "Paul" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
=?Utf-8?B?UGF1bA==?=
Guest
Posts: n/a
 
      06-15-2005
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!

"Brock Allen" wrote:

> 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.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
> > 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

>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
argparse and default for FileType Paolo Elvati Python 0 04-08-2011 06:11 PM
2to3 does not fix FileType from types Module; no replacement? mkieverpy@tlink.de Python 0 03-18-2009 09:55 AM
Half-Broken filetype association in XP Gerry Python 0 02-01-2008 05:40 PM
find all of *.filetype and copy them to destination folder daniel.michael.eaton@gmail.com Computer Support 3 08-02-2007 09:25 PM
Doubleclick unknown filetype in project tree oddity Edwin Knoppert ASP .Net 0 12-29-2005 08:36 AM



Advertisments