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 config file.
Once I do that, how do I differentiate between different pages with
the abcd extension, and write specific code for each page? (And keep
that code with the page, similar to codebehind.?)
Thanks,
Bryan 5 1810
After you register the .abcd extension in IIS by configurating it to be
handled by aspnet_isapi.dl l, you really don't have to write physical
files with .abcd extension. All your files would be .cs or .vb files
and they would have their own class names.
To really answer your question, you would probably have to create a
Page Handler Factory of classes. Probably utilize IHttpHandlerFac tory.
See http://msdn.microsoft.com/library/de...classtopic.asp
Once you have a handler, the handler is responsible entirely for the
processing. How you handle the different page names is entirely up to you.
From what you're asking, it seems that you don't want a custom HttpHandler;
you just want pages with a .abcd extension to be handled by ASP.Net page
classes. For that, all you need to do is configure IIS to hand off requests
for pages with that extension to the ASP.Net ISAPI.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
<br***@newsgrou ps.nospam> wrote in message
news:c3******** *************** *********@4ax.c om... 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 config file. Once I do that, how do I differentiate between different pages with the abcd extension, and write specific code for each page? (And keep that code with the page, similar to codebehind.?)
Thanks, Bryan
If all Bryan wants to do is add a specific extension ( .abcd ) to the
pages which are served by his server, he can use this in web.config:
<httpHandlers >
<add verb="GET, HEAD, POST, DEBUG" path="*.abcd" type="System.We b.UI.PageHandle rFactory"/>
</httpHandlers>
<compilation>
<buildProviders >
<add extension=".abc d" type="System.We b.Compilation.P ageBuildProvide r" />
</buildProviders>
</compilation>
and map the extension .abcd to aspnet_isapi.dl l in the
Application's configuration section in the Internet Service Manager.
That will cause ASP.NET to process the .abcd extension
in the exact same way it processes files with the .aspx extension.
That means that, if the page is named "whatever.abcd" , the corresponding
codebehind pages would need to be named : "whatever.abcd. cs" or "whatever.abcd. vb".
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message news:O2******** ******@TK2MSFTN GP15.phx.gbl... Once you have a handler, the handler is responsible entirely for the processing. How you handle the different page names is entirely up to you. From what you're asking, it seems that you don't want a custom HttpHandler; you just want pages with a .abcd extension to be handled by ASP.Net page classes. For that, all you need to do is configure IIS to hand off requests for pages with that extension to the ASP.Net ISAPI. -- HTH, Kevin Spencer Microsoft MVP .Net Developer If you push something hard enough, it will fall over. - Fudd's First Law of Opposition <br***@newsgrou ps.nospam> wrote in message news:c3******** *************** *********@4ax.c om... 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 config file. Once I do that, how do I differentiate between different pages with the abcd extension, and write specific code for each page? (And keep that code with the page, similar to codebehind.?)
Thanks, Bryan
Kevin Spencer wrote: From what you're asking, it seems that you don't want a custom HttpHandler; you just want pages with a .abcd extension to be handled by ASP.Net page classes. For that, all you need to do is configure IIS to hand off requests for pages with that extension to the ASP.Net ISAPI.
Doing it this way is fine. But, you would loose all IDE features that
VS.2005 provides since its doesn't understand the .abcd extension. But
if you write all your pages as .cs class files that inherit from
IHttpHandler then you can get the intellisense and other IDE
enhancements.
I should have added that's an ASP.NET 2.0-specific solution.
It's a bit simpler in ASP.NET 1.1.
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:uu******** ******@TK2MSFTN GP09.phx.gbl...
If all Bryan wants to do is add a specific extension ( .abcd ) to the
pages which are served by his server, he can use this in web.config:
<httpHandlers >
<add verb="GET, HEAD, POST, DEBUG" path="*.abcd" type="System.We b.UI.PageHandle rFactory"/>
</httpHandlers>
<compilation>
<buildProviders >
<add extension=".abc d" type="System.We b.Compilation.P ageBuildProvide r" />
</buildProviders>
</compilation>
and map the extension .abcd to aspnet_isapi.dl l in the
Application's configuration section in the Internet Service Manager.
That will cause ASP.NET to process the .abcd extension
in the exact same way it processes files with the .aspx extension.
That means that, if the page is named "whatever.abcd" , the corresponding
codebehind pages would need to be named : "whatever.abcd. cs" or "whatever.abcd. vb".
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:O2******** ******@TK2MSFTN GP15.phx.gbl... Once you have a handler, the handler is responsible entirely for the processing. How you handle the different page names is entirely up to you.
From what you're asking, it seems that you don't want a custom HttpHandler; you just want pages with a .abcd extension to be handled by ASP.Net page classes. For that, all you need to do is configure IIS to hand off requests for pages with that extension to the ASP.Net ISAPI.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer If you push something hard enough, it will fall over. - Fudd's First Law of Opposition
<br***@newsgrou ps.nospam> wrote in message news:c3******** *************** *********@4ax.c om... 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 config file. Once I do that, how do I differentiate between different pages with the abcd extension, and write specific code for each page? (And keep that code with the page, similar to codebehind.?)
Thanks, Bryan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael Iantosca |
last post by:
I have a custom attribute that I attach to certain pages in my application and I want to inspect each page request as it is made to see if the custom attribute is attached to the underlying page class. If is attached I want to perform some action.
How can I access custom attributes from an HttpModule? I have to pass a target to the
System.Attribute.GetCustomAttribute() call to attempt to retrieve the attached attribute.
I tried to access...
|
by: Søren Lund |
last post by:
Hello,
I have implemented a custom config section handler by implementing the
IConfigurationSectionHandler interface. I have registered this handler
in web.config and everything works fine ... for a while. At random
points in time my section handler stops working and throws the
exception:
Configuration Error
Description: An error occurred during the processing of a configuration
|
by: Adam |
last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have
developed the handler,
1. installed it into the gac
2. added it to the machine.config:
<httpHandlers>
<add verb="*" path="*.sgf" type="CustomExtensionHandler,
Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=d831d925597c1031" validate="True"/>
</httpHandlers>
|
by: Tabi |
last post by:
Hi,
I want to create a custom section in my web.config that can hold my custom
values. I created a section in web.config as written below.
<configSections>
<section name="myCustomSection"
type="ComIT.Applications.Common.ConfigurationSections.MyHandler"
allowLocation="true" allowDefinition="Everywhere" />
</configSections>
|
by: bryan |
last post by:
I've got a custom HttpHandler to process all requests for a given
extension. It gets invoked OK, but if I try to do a Server.Transfer I
get an HttpException. A Response.Redirect works, but I really need to
avoid the extra round-trip to the client.
I've tried Passing the page name, the full URL, and the instance of
the handler class to the Transfer method, but everything gets me the
same error 500.
Any help would be appreciated.
| |
by: Laurent Bugnion |
last post by:
Hi,
I like to develop custom controls for a number of webpages. These
controls are often customizable, so that they can be reused in a number
of situations.
My question is: What is the best practice for configuring a custom
control. As far as I can say, I have the following alternatives:
- Defining properties for the control, and setting these in the ASPX
|
by: Smithers |
last post by:
I have a Windows Forms application that implements a plug-in architecture
whereby required assemblies are identified and loaded dynamically.
Here are the relevant classes:
A = application = Windows Forms class
B = a singleton hosted within A. B is responsible for dynamically loading
classes X, Y, and Z.
|
by: Jordan S. |
last post by:
Using .NET 3.5... in a "plain old" .aspx page I have the following code in
the Init event:
this.Context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
this.Context.Response.Cache.SetCacheability(HttpCacheability.Public);
this.Context.Response.Cache.SetValidUntilExpires(false);
It works great. Testing shows that the page is cached for 60 seconds as
expected. Specifically, I insert the current date/time into the Response...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
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...
| |
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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();...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |