I'd like to have the concept of a Page (different code-behind file for
each url, session state, etc.) but be able to specify my own custom
HTTP payload.
(I don't want to use any Asp.Net forms, controls, etc.)
(Happens to be binary - but although I need to use HTTP, it's not going
to a browser.)
With IHttpHandler I lose Url->page mapping and sessions, but with Page
I don't have a way to override the HTTP processing, do I?
I'd expect that UI.Page would implement IHttpHandler with something
like:
public void ProcessRequest( System.Web.HttpContext context)
{
System.Web.UI.Forms.DefaultPageProcessor( context, this);
}
then I could just override this and everything would be fine.
Is there another class/interface I should be using, or another way to
hook HTTP-processing per-page??
Apologize ahead of time if I didn't RTFM enough.
thanks,
mike 5 1989
Hi Mike:
The handler asp.net chooses is configurable. So in the <httpHandlers>
section of machine.config you will see:
<add
verb="*"
path="*.aspx"
type="System.Web.UI.PageHandlerFactory"
/>
You can override the setting in your own web.config and implement your
own IHttpHandler derived handler.
Also, you may want to investigate using an .ashx extension. The
extension is mapped to a handler factory that will find your
IHttpHandler type and route the request to it - no config changes
required.
--
Scott http://www.OdeToCode.com/blogs/scott/
On 2 Mar 2005 15:12:02 -0800, vi********@yahoo.com wrote: I'd like to have the concept of a Page (different code-behind file for each url, session state, etc.) but be able to specify my own custom HTTP payload. (I don't want to use any Asp.Net forms, controls, etc.) (Happens to be binary - but although I need to use HTTP, it's not going to a browser.) With IHttpHandler I lose Url->page mapping and sessions, but with Page I don't have a way to override the HTTP processing, do I?
I'd expect that UI.Page would implement IHttpHandler with something like:
public void ProcessRequest( System.Web.HttpContext context) { System.Web.UI.Forms.DefaultPageProcessor( context, this); }
then I could just override this and everything would be fine.
Is there another class/interface I should be using, or another way to hook HTTP-processing per-page?? Apologize ahead of time if I didn't RTFM enough.
thanks, mike
Thanks, Scott. I was aware of the handlers/factories -- I was hoping to
still be able to use a Page and override the HTTP processing on a
per-page basic so I could get URL mapping and session support. I guess
I'll have to roll my own...
I still don't know why the Page wasn't designed to deletegate its
processing so you could override the default reflection-based engine as
necessary.
What makes you think you would lose Session? You can create an HttpHandler
that does everything a Page does (or not), and has access to the
HttpContext, just as a Page does. After all, a Page is just an
implementation of IHttpHandler. The guts of IHttpHandler is the
ProcessRequest() method:
void ProcessRequest(HttpContext context);
Note that the HttpContext, which includes Application, Session, etc. is
passed to the HttpHandler in this method.
You can read more about creaating HttpHandlers here: http://msdn.microsoft.com/library/de...tphandlers.asp
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
<vi********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... I'd like to have the concept of a Page (different code-behind file for each url, session state, etc.) but be able to specify my own custom HTTP payload. (I don't want to use any Asp.Net forms, controls, etc.) (Happens to be binary - but although I need to use HTTP, it's not going to a browser.) With IHttpHandler I lose Url->page mapping and sessions, but with Page I don't have a way to override the HTTP processing, do I?
I'd expect that UI.Page would implement IHttpHandler with something like:
public void ProcessRequest( System.Web.HttpContext context) { System.Web.UI.Forms.DefaultPageProcessor( context, this); }
then I could just override this and everything would be fine.
Is there another class/interface I should be using, or another way to hook HTTP-processing per-page?? Apologize ahead of time if I didn't RTFM enough.
thanks, mike
You don't need to override anything. You don't derive your HttpHandler from
Page. Implement IHttpHandler in your own class, and you're all set. The
implementation of the interface ensures that you will have the proper
methods to handle Requests. See my earlier reply for details.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
"Mike" <vi********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... Thanks, Scott. I was aware of the handlers/factories -- I was hoping to still be able to use a Page and override the HTTP processing on a per-page basic so I could get URL mapping and session support. I guess I'll have to roll my own... I still don't know why the Page wasn't designed to deletegate its processing so you could override the default reflection-based engine as necessary.
Hello Kevin, Note that the HttpContext, which includes Application, Session, etc. is passed to the HttpHandler in this method.
Just to add to your point, the HttpContext has a non-null Session object
in your IHttpHandler only if you also implement either IRequireSessionState
or IReadOnlySessionState.
--
Matt Berther http://www.mattberther.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
by: Philipp Schumann |
last post by:
Hi there,
I have added an aspx-Page "home.aspx" with the corresponding code-behind
class "home.cs".
I also have a HttpHandler class that implements IHttpHandler. Do you know
why the following...
|
by: Stu |
last post by:
Hi,
I am trying to write a basic httphandler to 'fake' that pages actually
exist. I have copied the code below from various sites - but the line
'Implements IHttpHandler' reports an error "type...
|
by: Chris Carter |
last post by:
Hi,
I created this HttpHandler, very simple:
using System;
using System.Web;
namespace HttpHandlerTest
{
public class HelloWorldHandler : IHttpHandler
|
by: David Thielen |
last post by:
Hi;
I have a IHttpHandler that is generating a page. If it throws an exception I
want to put up a nice page that is based on my master page so it looks good.
How can I redirect from my...
|
by: Mark Rae |
last post by:
Hi,
Is it possible to have programmatic access to the Page object in
Application_BeginRequest, or is it too early in the lifecycle...?
E.g. to be able to change a page's MasterPage...
|
by: =?Utf-8?B?U3VzaGlTZWFu?= |
last post by:
I have some problem. My old site had thousand pages which looks like
“info_.asp” and I did modification and now all content in database and
I can show it like this
“info_page.aspx?search=”...
|
by: zlf |
last post by:
Hello,
I try to use a custom HttpHandler to add something to session, then display
the original page.
public void ProcessRequest(HttpContext context)
{
context.Session = "test";
}
But, a...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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 projectplanning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |