473,434 Members | 1,829 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,434 software developers and data experts.

Create Pages on the fly using IHttpHandler. Need advice

Hello,

In this moment I am creating all my aspx pages on my vb.code at
runtime.

It seems nonsense to have .aspx and .aspx.vb files in my projects.

I am considering creating my pages on the fly using IHttpHandler.

I already did that for delivering XML files.

Could someone advice me on this?

What are the ups and downs of doing this?

Thanks,

Miguel

Nov 29 '06 #1
5 1689
I don't fully understand what you're trying to do...It seems like whatever
you are doing doesn't have an HTML/ASPX front-end component to it....

aspx files are handled by a built-in handler, called the PageHandler...it's
a relatively heavy process...it must raise a number of events (init, load,
prerender, unload are the most well known) as well as do a lot of postback
and viewstate manipulation.

If your requests aren't doing any of those, such as a RSS feed, then a
custom httphandler is typically the correct way to go. It's faster and it's
the right tool for the job.

On the flip side, you'll lose a lot of the framework laid out by the
PageHandler (which is quite a bit)..it's typically pretty obvious if you
need ASP.NET pages or not...

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@n67g2000cwd.googlegro ups.com...
Hello,

In this moment I am creating all my aspx pages on my vb.code at
runtime.

It seems nonsense to have .aspx and .aspx.vb files in my projects.

I am considering creating my pages on the fly using IHttpHandler.

I already did that for delivering XML files.

Could someone advice me on this?

What are the ups and downs of doing this?

Thanks,

Miguel
Nov 29 '06 #2
Hi,

Got it. I didn't know about the PageHandler part.

I was just looking for a way to solve a problem which I am fighting for
2 days:

How to set the following Nested Master Pages at runtime:

Parent.master
| ---- Child.master
| ------ Page.aspx

Yes, I know that in Page.aspx.vb I can do Me.MasterPageFile =
"~/_Child.master" on the PreInit event. However, I can't do the same on
Child.master.vb because I don't have a PreInit event there.

Do you know any article or have any code example which might help me
with this?

Thank You a Lot,
Miguel

Karl Seguin wrote:
I don't fully understand what you're trying to do...It seems like whatever
you are doing doesn't have an HTML/ASPX front-end component to it....

aspx files are handled by a built-in handler, called the PageHandler...it's
a relatively heavy process...it must raise a number of events (init, load,
prerender, unload are the most well known) as well as do a lot of postback
and viewstate manipulation.

If your requests aren't doing any of those, such as a RSS feed, then a
custom httphandler is typically the correct way to go. It's faster and it's
the right tool for the job.

On the flip side, you'll lose a lot of the framework laid out by the
PageHandler (which is quite a bit)..it's typically pretty obvious if you
need ASP.NET pages or not...

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@n67g2000cwd.googlegro ups.com...
Hello,

In this moment I am creating all my aspx pages on my vb.code at
runtime.

It seems nonsense to have .aspx and .aspx.vb files in my projects.

I am considering creating my pages on the fly using IHttpHandler.

I already did that for delivering XML files.

Could someone advice me on this?

What are the ups and downs of doing this?

Thanks,

Miguel
Nov 29 '06 #3
I was looking one of your articles in:

http://codebetter.com/blogs/karlsegu...24/145397.aspx

When you mean page model you are talking about events such as:

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As
EventArgs) Handles Me.PreInit
....
End Sub

Right? Is this what I would miss?

In IHttpHandler I would need to do something like:

AddHandler Label.Load, AddressOf Label_Load

Is this what you mean?

But would I need to do this for all events for all controls or only for
the events where I need to place some code in?

Using IHttpHandler to deliver the web pages have some advantages like
getting rid of the .aspx pages and making the web site a little bit
faster, right?
Are there any documents about doing this?

Just experimenting.

Thanks,

Miguel

shapper wrote:
Hi,

Got it. I didn't know about the PageHandler part.

I was just looking for a way to solve a problem which I am fighting for
2 days:

How to set the following Nested Master Pages at runtime:

Parent.master
| ---- Child.master
| ------ Page.aspx

Yes, I know that in Page.aspx.vb I can do Me.MasterPageFile =
"~/_Child.master" on the PreInit event. However, I can't do the same on
Child.master.vb because I don't have a PreInit event there.

Do you know any article or have any code example which might help me
with this?

Thank You a Lot,
Miguel

Karl Seguin wrote:
I don't fully understand what you're trying to do...It seems like whatever
you are doing doesn't have an HTML/ASPX front-end component to it....

aspx files are handled by a built-in handler, called the PageHandler...it's
a relatively heavy process...it must raise a number of events (init, load,
prerender, unload are the most well known) as well as do a lot of postback
and viewstate manipulation.

If your requests aren't doing any of those, such as a RSS feed, then a
custom httphandler is typically the correct way to go. It's faster and it's
the right tool for the job.

On the flip side, you'll lose a lot of the framework laid out by the
PageHandler (which is quite a bit)..it's typically pretty obvious if you
need ASP.NET pages or not...

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@n67g2000cwd.googlegro ups.com...
Hello,
>
In this moment I am creating all my aspx pages on my vb.code at
runtime.
>
It seems nonsense to have .aspx and .aspx.vb files in my projects.
>
I am considering creating my pages on the fly using IHttpHandler.
>
I already did that for delivering XML files.
>
Could someone advice me on this?
>
What are the ups and downs of doing this?
>
Thanks,
>
Miguel
>
Nov 29 '06 #4
Yes, that's what I mean.

If you have labels (or any controls) and master pages, then you don't want
to use your own handler.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
>I was looking one of your articles in:

http://codebetter.com/blogs/karlsegu...24/145397.aspx

When you mean page model you are talking about events such as:

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As
EventArgs) Handles Me.PreInit
....
End Sub

Right? Is this what I would miss?

In IHttpHandler I would need to do something like:

AddHandler Label.Load, AddressOf Label_Load

Is this what you mean?

But would I need to do this for all events for all controls or only for
the events where I need to place some code in?

Using IHttpHandler to deliver the web pages have some advantages like
getting rid of the .aspx pages and making the web site a little bit
faster, right?
Are there any documents about doing this?

Just experimenting.

Thanks,

Miguel

shapper wrote:
>Hi,

Got it. I didn't know about the PageHandler part.

I was just looking for a way to solve a problem which I am fighting for
2 days:

How to set the following Nested Master Pages at runtime:

Parent.master
| ---- Child.master
| ------ Page.aspx

Yes, I know that in Page.aspx.vb I can do Me.MasterPageFile =
"~/_Child.master" on the PreInit event. However, I can't do the same on
Child.master.vb because I don't have a PreInit event there.

Do you know any article or have any code example which might help me
with this?

Thank You a Lot,
Miguel

Karl Seguin wrote:
I don't fully understand what you're trying to do...It seems like
whatever
you are doing doesn't have an HTML/ASPX front-end component to it....

aspx files are handled by a built-in handler, called the
PageHandler...it's
a relatively heavy process...it must raise a number of events (init,
load,
prerender, unload are the most well known) as well as do a lot of
postback
and viewstate manipulation.

If your requests aren't doing any of those, such as a RSS feed, then a
custom httphandler is typically the correct way to go. It's faster and
it's
the right tool for the job.

On the flip side, you'll lose a lot of the framework laid out by the
PageHandler (which is quite a bit)..it's typically pretty obvious if
you
need ASP.NET pages or not...

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@n67g2000cwd.googlegro ups.com...
Hello,

In this moment I am creating all my aspx pages on my vb.code at
runtime.

It seems nonsense to have .aspx and .aspx.vb files in my projects.

I am considering creating my pages on the fly using IHttpHandler.

I already did that for delivering XML files.

Could someone advice me on this?

What are the ups and downs of doing this?

Thanks,

Miguel
Nov 30 '06 #5
I was able to solve the problem by doing hooking into the constructor for
Child.master...dunno if you'll have any side effects this way though...

public sub Child()
MasterPageFile = "Parent.master"
end sub

Pages, controls and masterpages are all class deep down...and if something
fires BEFORE PreInit, the constructor must be it :)

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11**********************@14g2000cws.googlegro ups.com...
Hi,

Got it. I didn't know about the PageHandler part.

I was just looking for a way to solve a problem which I am fighting for
2 days:

How to set the following Nested Master Pages at runtime:

Parent.master
| ---- Child.master
| ------ Page.aspx

Yes, I know that in Page.aspx.vb I can do Me.MasterPageFile =
"~/_Child.master" on the PreInit event. However, I can't do the same on
Child.master.vb because I don't have a PreInit event there.

Do you know any article or have any code example which might help me
with this?

Thank You a Lot,
Miguel

Karl Seguin wrote:
>I don't fully understand what you're trying to do...It seems like
whatever
you are doing doesn't have an HTML/ASPX front-end component to it....

aspx files are handled by a built-in handler, called the
PageHandler...it's
a relatively heavy process...it must raise a number of events (init,
load,
prerender, unload are the most well known) as well as do a lot of
postback
and viewstate manipulation.

If your requests aren't doing any of those, such as a RSS feed, then a
custom httphandler is typically the correct way to go. It's faster and
it's
the right tool for the job.

On the flip side, you'll lose a lot of the framework laid out by the
PageHandler (which is quite a bit)..it's typically pretty obvious if you
need ASP.NET pages or not...

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@n67g2000cwd.googlegr oups.com...
Hello,

In this moment I am creating all my aspx pages on my vb.code at
runtime.

It seems nonsense to have .aspx and .aspx.vb files in my projects.

I am considering creating my pages on the fly using IHttpHandler.

I already did that for delivering XML files.

Could someone advice me on this?

What are the ups and downs of doing this?

Thanks,

Miguel
Nov 30 '06 #6

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

Similar topics

2
by: clintonG | last post by:
Are developers still using namespaces in their code for pages or is this practice no longer neccessary for pages? I don't see the rationale here. except perhaps for controls that are comprised of...
0
by: lapin | last post by:
I'm trying to get access to session variables from an IHttpHandler class. In several places I've seen the solution posted as in this message: >If you define your own custom HttpHandler, you need...
1
by: lapin | last post by:
I'm trying to get access to session variables from an IHttpHandler class. In several places I've seen the solution posted as in this message: >If you define your own custom HttpHandler, you...
6
by: Kentamanos | last post by:
Please don't ask me why I'm doing this (trust me, it makes sense in my system), but I'd like to basically redirect requests for a certain extension (thus a handler) to an ASPX page behind the scenes....
4
by: Igor K | last post by:
Hi all, I'm developing asp.net website. Most of the pages are aspx, but let's say, some 10% are html. For this html pages i use httphandlers to intercept calls and to perform some job on this...
2
by: bryan | last post by:
I can't find much info on what makes an instance of the handler reusable. If it maintains no internal state, I would assume that it is safe to be reusable - correct? I have one that grabs a value...
1
by: Aartware | last post by:
I've read all the items about the IHttpHandler and the session-object and I see nothing wrong with my code, but still I have no session object. This is my code: Imports System Imports...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.