use httphandler to dynamically output system.web.ui.page via Master Page

Z

zootius

Hi - I'm working on a front-controller style application in ASP.NET
2.0. I have mapped all HTTP requests to ASPNET_ISAPI, and use an
HttpModule to do a database lookup on the search-engine-friendly URLs
that my app uses, in order to select the correct output for the
context.

Mapping the HTTP request to a physical ASPX page seems fairly
straightforward with HttpContext.RewritePath. However, I don't really
want any physical ASPX pages in my app. All my content lives in the
database, so I'd rather create a System.Web.UI.Page object in the
HttpHandler, set it to use a MasterPage for templating the output, and
add WebControls and Content to it as required by the request URL
context.

Anyway, I created a class that extends System.Web.UI.Page and set this
as my HttpHandler in web.config. Lo and behold, I can get it it to
handle requests. HOWEVER - I can't get it to work with MasterPages when
I try to set it via the Page.MasterPageFile property. The
"MasterPage.CreateMaster()" fails in its call to
"VirtualPathProvider.CombineVirtualPathsInternal()" because apparently
basePath is null.

Has anybody else solved this?
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top