.NETGURU
how to invoke PageHandlerFactory from an HttpHandler?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspnghttphandlers' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Stuart C. Salsbury
PageHandlerFactory does not have a public constructor and it's killing me.

In IIS config, I have redirected all requests (extension = *) to the .net
framework. I have an HttpHandler set to handle all such requests. Now I
want that handler to do some thinking, then assign the processing to an
.aspx page.

I know how to assign the processing to a code-only page (just call
ProcessRequest from the IHttpHandler interface). However, since
PageHandlerFactory isn't creatable I don't know how to transfer processing
to .aspx files.

Can anyone help me out?

Thanks,
Stuart Salsbury
Ernst & Young LLP

Reply to this message...
 
    
Mitch Denny (VIP)
Stuart,

You could possibly inherit from the PageHandlerFactory class
and do the customisation that way, but the information you
have provided doesn't seem to make the solution clear.

Optimally you could implement this in a class that implements
the IHttpModule interface, you could then attach event handlers
from the HttpContext within the Init(...) method.

Can you give us a non-technical run down of what you do then
a better solution might present it self.

----------------------------------------
- Mitch Denny
- http://www.warbyte.com
- Click here to reveal e-mail address
- +61 (414) 610-141
-

[Original message clipped]

Reply to this message...
 
    
Stuart C. Salsbury
Mitch,

Thanks for your response. The solution that I've just found (while trying
to write to you to clarify my problem) is to implement an
IHttpHandlerFactory that alters the path parameter that it is given prior to
invoking a PageParser.GetCompiledPageInstance method.

public IHttpHandler GetHandler(HttpContext context, string requestType,
string url, string pathTranslated)
{
    context.Trace.IsEnabled = true;
    return PageParser.GetCompiledPageInstance("the url and requestType don't
seem to matter to the PageParser... see trace for proof",
@"c:\inetpub\wwwroot\testsite\default.aspx", context);
}

Mitch, thanks you for prodding me to be more specific... it helped. If
anyone knows that the url and requestType are valued by the PageParser and
the resulting Page, please let me know.

Thanks,
Stuart

P.S. I've seen people bumming around for ways to directly incorporate aspx
and ascx files from other web apps / servers... I wonder if the PageParser
would allow this?

-----Original Message-----
From: Mitch Denny [mailto:Click here to reveal e-mail address]
Sent: Monday, June 25, 2001 10:23 PM
To: aspnghttphandlers
Subject: [aspnghttphandlers] RE: how to invoke PageHandlerFactory from an
HttpHandler?

Stuart,

You could possibly inherit from the PageHandlerFactory class
and do the customisation that way, but the information you
have provided doesn't seem to make the solution clear.

Optimally you could implement this in a class that implements
the IHttpModule interface, you could then attach event handlers
from the HttpContext within the Init(...) method.

Can you give us a non-technical run down of what you do then
a better solution might present it self.

----------------------------------------
- Mitch Denny
- http://www.warbyte.com
- Click here to reveal e-mail address
- +61 (414) 610-141
-

[Original message clipped]

| [aspnghttphandlers] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspnghttphandlers.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
Mitch Denny (VIP)
Stuart,

I think the URL parameter on the GetHandler method is
just for reference. I can't think of a reason why it is
useful, because the RawUrl property provides that information
in the HttpRequest property of the HttpContext. Unless ofcourse
the string provided in the call primes that actual value.

Perhaps someone from Microsoft might be able to explain that
one. Scott, Susan?

----------------------------------------
- Mitch Denny
- http://www.warbyte.com
- Click here to reveal e-mail address
- +61 (414) 610-141
-

[Original message clipped]

Reply to this message...
 
    
Ihor Bobak
class MyOwnPageHandlerFactory : IHttpHandlerFactory
{
    public virtual IHttpHandler GetHandler (HttpContext context, string requestType, string url, string path)
    {
        return PageParser.GetCompiledPageInstance (url, path, context);
    }

    public virtual void ReleaseHandler (IHttpHandler handler)
    {
    }
}
Reply to this message...
 
 
System.Web.HttpContext
System.Web.HttpRequest
System.Web.IHttpHandler
System.Web.IHttpHandlerFactory
System.Web.IHttpModule
System.Web.UI.PageParser




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification