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

Http Handler Question

Hello,

This may seem very obvious to someone else, but I'm at a loss for an
answer to this problem.

I have written an HttpHandler that opens up an html file and returns a
string. This works great, but what if I have a file that is .aspx? I
realize that I'm always going to get just straight text/string as my
output, but I don't know what to look for or call in order to process
the .aspx correctly.

My goal is to have a url like http://www.website.com/mypage.html open
up the file mypage.html and also wrap a design around it. The current
method that I have in place works great for static navigation, but
will not work for something that needs to be compiled by the aspnet
dll.

Below is a very simplified diagram of what I'm trying to do:

-----------------------------------------------
web.config is:
----------------
<httpHandlers>
<add verb="*" path="*.aspx,*.htm"
type="CALS.CalsHandler,CalsHandler" />
</httpHandlers>

-----------------------------------------------
handler code is:
----------------
public void ProcessRequest(HttpContext context)
{
HttpResponse objResponse = context.Response;
HttpRequest objRequest = context.Request;
PageBuilder pgBuild = new PageBuilder();
objResponse.Write(pgBuild.Build(objRequest.Physica lApplicationPath,
objRequest.PhysicalPath));
}
-----------------------------------------------

Note that PageBuilder is an object designed to create the output for
the browser (string not aspx).

Cheers!
Joe
Nov 17 '05 #1
4 1395
Take a look at
PageParser.GetCompiledPageInstance

Hope this helps
Brian W

"Joe Spooner" <jm*******@ifas.ufl.edu> wrote in message
news:14**************************@posting.google.c om...
Hello,

This may seem very obvious to someone else, but I'm at a loss for an
answer to this problem.

I have written an HttpHandler that opens up an html file and returns a
string. This works great, but what if I have a file that is .aspx? I
realize that I'm always going to get just straight text/string as my
output, but I don't know what to look for or call in order to process
the .aspx correctly.

My goal is to have a url like http://www.website.com/mypage.html open
up the file mypage.html and also wrap a design around it. The current
method that I have in place works great for static navigation, but
will not work for something that needs to be compiled by the aspnet
dll.

Below is a very simplified diagram of what I'm trying to do:

-----------------------------------------------
web.config is:
----------------
<httpHandlers>
<add verb="*" path="*.aspx,*.htm"
type="CALS.CalsHandler,CalsHandler" />
</httpHandlers>

-----------------------------------------------
handler code is:
----------------
public void ProcessRequest(HttpContext context)
{
HttpResponse objResponse = context.Response;
HttpRequest objRequest = context.Request;
PageBuilder pgBuild = new PageBuilder();
objResponse.Write(pgBuild.Build(objRequest.Physica lApplicationPath,
objRequest.PhysicalPath));
}
-----------------------------------------------

Note that PageBuilder is an object designed to create the output for
the browser (string not aspx).

Cheers!
Joe

Nov 17 '05 #2
SF
You might wanna checkout Sitemesh.Net. It is providing you exactly with
what you want, a page decorator: http://wiki.truemesh.com/sitemesh.net

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:ug**************@tk2msftngp13.phx.gbl...
Take a look at
PageParser.GetCompiledPageInstance

Hope this helps
Brian W

"Joe Spooner" <jm*******@ifas.ufl.edu> wrote in message
news:14**************************@posting.google.c om...
Hello,

This may seem very obvious to someone else, but I'm at a loss for an
answer to this problem.

I have written an HttpHandler that opens up an html file and returns a
string. This works great, but what if I have a file that is .aspx? I
realize that I'm always going to get just straight text/string as my
output, but I don't know what to look for or call in order to process
the .aspx correctly.

My goal is to have a url like http://www.website.com/mypage.html open
up the file mypage.html and also wrap a design around it. The current
method that I have in place works great for static navigation, but
will not work for something that needs to be compiled by the aspnet
dll.

Below is a very simplified diagram of what I'm trying to do:

-----------------------------------------------
web.config is:
----------------
<httpHandlers>
<add verb="*" path="*.aspx,*.htm"
type="CALS.CalsHandler,CalsHandler" />
</httpHandlers>

-----------------------------------------------
handler code is:
----------------
public void ProcessRequest(HttpContext context)
{
HttpResponse objResponse = context.Response;
HttpRequest objRequest = context.Request;
PageBuilder pgBuild = new PageBuilder();
objResponse.Write(pgBuild.Build(objRequest.Physica lApplicationPath,
objRequest.PhysicalPath));
}
-----------------------------------------------

Note that PageBuilder is an object designed to create the output for
the browser (string not aspx).

Cheers!
Joe


Nov 17 '05 #3
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:ug**************@tk2msftngp13.phx.gbl...
Take a look at
PageParser.GetCompiledPageInstance


Brian, we should remind people that "This member supports the .NET Framework
infrastructure and is not intended to be used directly from your code.".

Of course, I use it also, in the absence of any
"GetTheStandardHttpHandlerFor" method. Take a hint, Microsoft!
--
John
Nov 17 '05 #4
John,

I agree with you totally. If I could implement something like
GetTheStandardHttpHandlerFor, then I would feel a lot happier about
putting this into a large web application.

For now my best solution is to use the following design (aka -
band-aid):

1. Catch .html extension
2. Use a template (aspx) to open the html file and also provide the
design for content by using the PageParser.GetCompiledPageInstance. I
create a querystring off of the .html file name & directory and pull
the file out that way.

This is truly not cool and not elegant, but I know it will work. I
hope Microsoft catches on to this and makes some changes so that web
app's and web sites can be more object oriented (at least in my
limited perspective).

Thanks,
Joe

"John Saunders" <john.saunders at surfcontrol.com> wrote in message news:<#1*************@TK2MSFTNGP11.phx.gbl>...
"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:ug**************@tk2msftngp13.phx.gbl...
Take a look at
PageParser.GetCompiledPageInstance


Brian, we should remind people that "This member supports the .NET Framework
infrastructure and is not intended to be used directly from your code.".

Of course, I use it also, in the absence of any
"GetTheStandardHttpHandlerFor" method. Take a hint, Microsoft!

Nov 17 '05 #5

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

Similar topics

7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
0
by: Novice | last post by:
Hey all, I've already posted this question and two posters offered suggestions and they worked - but now I would like to know why - and if possible the answer to a second question. Here is my...
3
by: Mark Olbert | last post by:
I have a custom http handler set for an ASP.NET site which handles requests for ".scef" pages. It works fine once IIS is properly configured. I've noticed something about the handler, though,...
2
by: Jukka Aho | last post by:
When converting Unicode strings to legacy character encodings, it is possible to register a custom error handler that will catch and process all code points that do not have a direct equivalent in...
6
by: =?Utf-8?B?cHJhZGVlcF9UUA==?= | last post by:
I am trying to create a simple HTTP handler in ASP.net 2.0. I am using VS 2005. I am trying to handle a custom extension file givein in the URL. I have also created the following entry in the...
3
by: wolverine | last post by:
Hi, I am injecting a javascript code into html pages and attaching some dom events to some elements via attachEvent (IE only). I just want to know that is there any chance by which my event...
3
by: rn5a | last post by:
Can HTTP handlers be used to upload files to a server in ASP.NET? If yes, then how? Thanks
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
24
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new...
2
by: wolverine | last post by:
Hi All, In Mozilla Firefox, to onblur and onfocus event of each and every html element, the browser itself will attach a native event handler. I mean if you type,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.