473,748 Members | 4,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cals Handler,CalsHan dler" />
</httpHandlers>

-----------------------------------------------
handler code is:
----------------
public void ProcessRequest( HttpContext context)
{
HttpResponse objResponse = context.Respons e;
HttpRequest objRequest = context.Request ;
PageBuilder pgBuild = new PageBuilder();
objResponse.Wri te(pgBuild.Buil d(objRequest.Ph ysicalApplicati onPath,
objRequest.Phys icalPath));
}
-----------------------------------------------

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

Cheers!
Joe
Nov 17 '05 #1
4 1406
Take a look at
PageParser.GetC ompiledPageInst ance

Hope this helps
Brian W

"Joe Spooner" <jm*******@ifas .ufl.edu> wrote in message
news:14******** *************** ***@posting.goo gle.com...
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.Cals Handler,CalsHan dler" />
</httpHandlers>

-----------------------------------------------
handler code is:
----------------
public void ProcessRequest( HttpContext context)
{
HttpResponse objResponse = context.Respons e;
HttpRequest objRequest = context.Request ;
PageBuilder pgBuild = new PageBuilder();
objResponse.Wri te(pgBuild.Buil d(objRequest.Ph ysicalApplicati onPath,
objRequest.Phys icalPath));
}
-----------------------------------------------

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_de ath_2_spam_rush .com> wrote in message
news:ug******** ******@tk2msftn gp13.phx.gbl...
Take a look at
PageParser.GetC ompiledPageInst ance

Hope this helps
Brian W

"Joe Spooner" <jm*******@ifas .ufl.edu> wrote in message
news:14******** *************** ***@posting.goo gle.com...
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.Cals Handler,CalsHan dler" />
</httpHandlers>

-----------------------------------------------
handler code is:
----------------
public void ProcessRequest( HttpContext context)
{
HttpResponse objResponse = context.Respons e;
HttpRequest objRequest = context.Request ;
PageBuilder pgBuild = new PageBuilder();
objResponse.Wri te(pgBuild.Buil d(objRequest.Ph ysicalApplicati onPath,
objRequest.Phys icalPath));
}
-----------------------------------------------

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_de ath_2_spam_rush .com> wrote in message
news:ug******** ******@tk2msftn gp13.phx.gbl...
Take a look at
PageParser.GetC ompiledPageInst ance


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
"GetTheStandard HttpHandlerFor" method. Take a hint, Microsoft!
--
John
Nov 17 '05 #4
John,

I agree with you totally. If I could implement something like
GetTheStandardH ttpHandlerFor, 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.GetC ompiledPageInst ance. 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.saunder s at surfcontrol.com > wrote in message news:<#1******* ******@TK2MSFTN GP11.phx.gbl>.. .
"Brian W" <brianw@gold_de ath_2_spam_rush .com> wrote in message
news:ug******** ******@tk2msftn gp13.phx.gbl...
Take a look at
PageParser.GetC ompiledPageInst ance


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
"GetTheStandard HttpHandlerFor" 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
49581
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. The question is about best practices for passing parameters to an event function. I have, say, the following HTML:
0
1817
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 problem: I am trying to write a custom WebControl - at some point this WebControl will output a bunch of controls into several Panel objects. But I just recently got my WebControl to output a single button and attach an event handler to that...
3
1157
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, that I want to confirm. Let's say my site has a "virtual" page that the handler should generate called www.scef.us/test2.scef. If I enter that address in the address bar of a browser -- and the site's ASP.NET process isn't running (it's not a...
2
2483
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 the target encoding (as described in PEP 293). The thing to note here is that the error handler itself is required to return the substitutions as Unicode strings - not as the target encoding bytestrings. Some lower-level gadgetry will silently...
6
2839
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 web.config file <httpHandlers> <add verb="*" path="*.imgw" type="Customhandler.Handler,Handler" /> </httpHandlers> following is the code in Handler.ashx file
3
2365
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 handler not getting executed ? ie, is there some means for the web developer to prevent any further handler getting executed for the same event on the same element ? To be more clear, assume the web developer has attached function "f1()" on onclick...
3
1635
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
3256
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 do it. If I bring this same code outside this event handler, it works just fine. Is this normal?
24
55221
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 EventHandler(Onbutton_click); I want to pass more information related that event. & want to use that
2
4706
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, 'javascript:alert(window.blur)' in the address bar of Firefox browser, you can see a 'function ....' . That is a Firefox browser defined handler. Now assume that web developer also attach event handlers to 'onblur' events eg: 'window.blur=f3()'
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8242
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6074
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.