473,244 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,244 software developers and data experts.

Do i loose the power of asp.net if i use a custom extension (not .aspx) with IHttpHandlerFactory

I want to use my custom url extension instead of .aspx. I can achieve this
by writing a custom handler that implements the IHttpHandlerFactory.
In the GetHandler method of the IHttpHandlerFactory i want to construct a
Page class instance and load my other controls to it and return the page
instance.
This is what .net framework does. There is a small difference what i am
thinking and the .net framework has done. .Net Framework calls the
PageParser.GetCompiledPageInstance() methot to take the page from the cached
content. In my implemention, instance of the Page class is created and it is
returned.

Ex:

PageHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
InternalSecurityPermissions.UnmanagedCode.Assert() ;
return PageParser.GetCompiledPageInstanceInternal(url, path, context);
}

<add verb="*" path="*.umut" type="MyOwnHandlerFactory"/>
MyOwnHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
Page page = new Page

page.Controls.Add ( new System.Web.UI.LiteralControl
("<html><head></head><body>");
System.Web.UI.HtmlControls.HtmlForm form = new
System.Web.UI.HtmlControls.HtmlForm ()
form.Name = "Form1";
form.Method = "Post";
page.Controls.Add (form);
Control c1 = page.LoadControl (ABC.ascx);
form.Controls.Add (c1);
page.Controls.Add ( new System.Web.UI.LiteralControl ("</body><html>");
return page.
}

I have described what the .net framework does and the one in my mind. I am
still using the framework but only i have different extension.
As a summary:

1) Do i loose the cache functionality of the PageParser. (May be it is
not necessary because i am only parsing UserControls with page.LoadControl)
2) Can i use everthing that asp.net supports like Session, ViewState
etc?
Nov 19 '05 #1
3 1507
Why go to all that work? Just register in web.config your custom handler
and map it onto the existing ASPX handler:

<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.umut" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
</system.web>
</configuration>

-Brock
DevelopMentor
http://staff.develop.com/ballen
I want to use my custom url extension instead of .aspx. I can achieve
this
by writing a custom handler that implements the IHttpHandlerFactory.
In the GetHandler method of the IHttpHandlerFactory i want to
construct a
Page class instance and load my other controls to it and return the
page
instance.
This is what .net framework does. There is a small difference what i
am
thinking and the .net framework has done. .Net Framework calls the
PageParser.GetCompiledPageInstance() methot to take the page from the
cached
content. In my implemention, instance of the Page class is created and
it is
returned.
Ex:

PageHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
InternalSecurityPermissions.UnmanagedCode.Assert() ;
return PageParser.GetCompiledPageInstanceInternal(url, path,
context);
}
<add verb="*" path="*.umut" type="MyOwnHandlerFactory"/>
MyOwnHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
Page page = new Page
page.Controls.Add ( new System.Web.UI.LiteralControl
("<html><head></head><body>");
System.Web.UI.HtmlControls.HtmlForm form = new
System.Web.UI.HtmlControls.HtmlForm ()
form.Name = "Form1";
form.Method = "Post";
page.Controls.Add (form);
Control c1 = page.LoadControl (ABC.ascx);
form.Controls.Add (c1);
page.Controls.Add ( new System.Web.UI.LiteralControl
("</body><html>");
return page.
}
I have described what the .net framework does and the one in my mind.
I am
still using the framework but only i have different extension.
As a summary:
1) Do i loose the cache functionality of the PageParser. (May be
it is
not necessary because i am only parsing UserControls with
page.LoadControl)
2) Can i use everthing that asp.net supports like Session,
ViewState
etc?


Nov 19 '05 #2
That's entirely correct.

I'd also map the extension in the Application's "Configuration"
section in the "Virtual Directory" tab of the IIS MMC.

If using ASP.NET 2.0, he'd also need to add:

<compilation>
<buildProviders>
<add extension=".umut" appliesTo="Web" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message news:87**********************@msnews.microsoft.com ...
Why go to all that work? Just register in web.config your custom handler
and map it onto the existing ASPX handler:

<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.umut" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
</system.web>
</configuration>

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



I want to use my custom url extension instead of .aspx. I can achieve
this
by writing a custom handler that implements the IHttpHandlerFactory.
In the GetHandler method of the IHttpHandlerFactory i want to
construct a
Page class instance and load my other controls to it and return the
page
instance.
This is what .net framework does. There is a small difference what i
am
thinking and the .net framework has done. .Net Framework calls the
PageParser.GetCompiledPageInstance() methot to take the page from the
cached
content. In my implemention, instance of the Page class is created and
it is
returned.
Ex:

PageHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
InternalSecurityPermissions.UnmanagedCode.Assert() ;
return PageParser.GetCompiledPageInstanceInternal(url, path,
context);
}
<add verb="*" path="*.umut" type="MyOwnHandlerFactory"/>
MyOwnHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
Page page = new Page
page.Controls.Add ( new System.Web.UI.LiteralControl
("<html><head></head><body>");
System.Web.UI.HtmlControls.HtmlForm form = new
System.Web.UI.HtmlControls.HtmlForm ()
form.Name = "Form1";
form.Method = "Post";
page.Controls.Add (form);
Control c1 = page.LoadControl (ABC.ascx);
form.Controls.Add (c1);
page.Controls.Add ( new System.Web.UI.LiteralControl
("</body><html>");
return page.
}
I have described what the .net framework does and the one in my mind.
I am
still using the framework but only i have different extension.
As a summary:
1) Do i loose the cache functionality of the PageParser. (May be
it is
not necessary because i am only parsing UserControls with
page.LoadControl)
2) Can i use everthing that asp.net supports like Session,
ViewState
etc?



Nov 19 '05 #3
I know that, but i dont want lots of .aspx files. I am developing a control.
Instead of it, my consumers use .ascx user controls.
That is why i am tring to create Page instance on the fly.

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:87**********************@msnews.microsoft.com ...
Why go to all that work? Just register in web.config your custom handler
and map it onto the existing ASPX handler:

<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.umut" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
</system.web>
</configuration>

-Brock
DevelopMentor
http://staff.develop.com/ballen
I want to use my custom url extension instead of .aspx. I can achieve
this
by writing a custom handler that implements the IHttpHandlerFactory.
In the GetHandler method of the IHttpHandlerFactory i want to
construct a
Page class instance and load my other controls to it and return the
page
instance.
This is what .net framework does. There is a small difference what i
am
thinking and the .net framework has done. .Net Framework calls the
PageParser.GetCompiledPageInstance() methot to take the page from the
cached
content. In my implemention, instance of the Page class is created and
it is
returned.
Ex:

PageHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
InternalSecurityPermissions.UnmanagedCode.Assert() ;
return PageParser.GetCompiledPageInstanceInternal(url, path,
context);
}
<add verb="*" path="*.umut" type="MyOwnHandlerFactory"/>
MyOwnHandlerFactory
public virtual IHttpHandler GetHandler(HttpContext context, string
requestType, string url, string path)
{
Page page = new Page
page.Controls.Add ( new System.Web.UI.LiteralControl
("<html><head></head><body>");
System.Web.UI.HtmlControls.HtmlForm form = new
System.Web.UI.HtmlControls.HtmlForm ()
form.Name = "Form1";
form.Method = "Post";
page.Controls.Add (form);
Control c1 = page.LoadControl (ABC.ascx);
form.Controls.Add (c1);
page.Controls.Add ( new System.Web.UI.LiteralControl
("</body><html>");
return page.
}
I have described what the .net framework does and the one in my mind.
I am
still using the framework but only i have different extension.
As a summary:
1) Do i loose the cache functionality of the PageParser. (May be
it is
not necessary because i am only parsing UserControls with
page.LoadControl)
2) Can i use everthing that asp.net supports like Session,
ViewState
etc?


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jon Spivey | last post by:
Hi, I've set up a custom error like this <customErrors mode="On" defaultRedirect="ErrorPage.aspx"> <error statusCode="404" redirect="error404.aspx" /> </customErrors> So requests for...
1
by: Laurie Dvorak | last post by:
I'm working on converting a website that currently is all static HTML pages to ASP.NET. Since people may have some of the HTML pages bookmarked, I want to give them a meaningful error message...
5
by: bryan | last post by:
If I understand correctly, I can write a custom handler for a given extension (say .abcd files) by writing a class that implements the IHttpHandler interface and then registering it in my web...
1
by: Mutley | last post by:
Hi, I have written an HttpHandler to process page requests for a custom file extension. The handler gets called as expected and after searching the web for examples I have used a method called...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.