How would I set up an httpHandler so that it would only apply to certain
child directories of the application?
I.E:
<httpHandlers >
<add verb="*" path="/files/*/*/*/*.aspx"
type="App.HttpH andlers.ThreeDe epPage, App" />
<add verb="*" path="/files/*/*/*.aspx"
type="App.HttpH andlers.TwoDeep Page, App" />
</httpHandlers>
The wildcard character for a directory causes an error, and before I even
tried it I thought it would. I am guessing I would probably have to do this
using a custom configSection, but I'm not sure how to do it.
TIA,
Grant 4 3324
Why don't you just list them out?
<add verb="*" path="/files/certain1/bob.axd", type="..." />
<add verb="*" path="/files/certain2/bob.axd", type="..." />
<add verb="*" path="/files/certain2/deeper/bob.axd", type="..." />
bill
"Grant Harmeyer" <ne*@internetap ollo.com> wrote in message
news:eO******** ******@TK2MSFTN GP11.phx.gbl... How would I set up an httpHandler so that it would only apply to certain child directories of the application?
I.E: <httpHandlers > <add verb="*" path="/files/*/*/*/*.aspx" type="App.HttpH andlers.ThreeDe epPage, App" /> <add verb="*" path="/files/*/*/*.aspx" type="App.HttpH andlers.TwoDeep Page, App" /> </httpHandlers>
The wildcard character for a directory causes an error, and before I even tried it I thought it would. I am guessing I would probably have to do
this using a custom configSection, but I'm not sure how to do it.
TIA,
Grant
The directories will have dynamic names for years, months and days. Also,
the file names will be dynamic (managed by a file system of sorts that I
don't have much control over).
i.e:
<add verb="*" path="/files/2004/10/7/SomeFile.axd", type="..." />
<add verb="*" path="/files/2004/12/15/SomeFile2.axd", type="..." />
Considering that I have no idea how many files there may be or what the 2nd
or 3rd level directory names may be, I was hoping to use wildcards to
achieve this. It's an odd problem I know.
Grant
"William F. Robertson, Jr." <wfrobertson_at _kpmg_dot_com> wrote in message
news:On******** *****@TK2MSFTNG P12.phx.gbl... Why don't you just list them out?
<add verb="*" path="/files/certain1/bob.axd", type="..." /> <add verb="*" path="/files/certain2/bob.axd", type="..." /> <add verb="*" path="/files/certain2/deeper/bob.axd", type="..." />
bill
"Grant Harmeyer" <ne*@internetap ollo.com> wrote in message news:eO******** ******@TK2MSFTN GP11.phx.gbl... How would I set up an httpHandler so that it would only apply to certain child directories of the application?
I.E: <httpHandlers > <add verb="*" path="/files/*/*/*/*.aspx" type="App.HttpH andlers.ThreeDe epPage, App" /> <add verb="*" path="/files/*/*/*.aspx" type="App.HttpH andlers.TwoDeep Page, App" /> </httpHandlers>
The wildcard character for a directory causes an error, and before I even tried it I thought it would. I am guessing I would probably have to do this using a custom configSection, but I'm not sure how to do it.
TIA,
Grant
Hi there,
are you sure that HttpHandler is even able to handle child directories? I
red somewhere that for each subdirectory it's own configuration should be
done (I mean: bin directory, IIS configuration, web.config...).
Are you maybe mixing HttpModule with it?
Please correct me if I'm wrong,
Igor
"William F. Robertson, Jr." <wfrobertson_at _kpmg_dot_com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Okay, here is the path you want to take then.
<add verb="*" path="/files/Level1Handler.a xd", type="..." /> <add verb="*" path="/files/Level2Handler.a xd", type="..." />
In Global.cs, you will want to use HttpContext.Rew ritePath to achieve this.
Here is a test snippet I used. You might want to explore the Request object to see if there is a better way, but RawUrl works for demostration purposes.
protected void Application_Beg inRequest( object sender, EventArgs e ) { string url = Context.Request .RawUrl.ToUpper (); if ( url.EndsWith( "LEVEL1HANDLER. AXD" ) ) //this will covert "files/*/Level1Handler.a xd" { Context.Rewrite Path( "/files/Level1Handler.a xd" ); } else if ( url.EndsWith( "LEVEL2HANDLER. AXD" ) ) { Context.Rewrite Path( "/files/Level2Hanlder.a xd" ); } }
I hope this is what you are looking for. Or atleast you can use this to get where you are going.
bill
"Grant Harmeyer" <ne*@internetap ollo.com> wrote in message news:u$******** ******@TK2MSFTN GP11.phx.gbl... The directories will have dynamic names for years, months and days. Also, the file names will be dynamic (managed by a file system of sorts that I don't have much control over).
i.e: <add verb="*" path="/files/2004/10/7/SomeFile.axd", type="..." /> <add verb="*" path="/files/2004/12/15/SomeFile2.axd", type="..." />
Considering that I have no idea how many files there may be or what the 2nd or 3rd level directory names may be, I was hoping to use wildcards to achieve this. It's an odd problem I know.
Grant
"William F. Robertson, Jr." <wfrobertson_at _kpmg_dot_com> wrote in message news:On******** *****@TK2MSFTNG P12.phx.gbl... > Why don't you just list them out? > > <add verb="*" path="/files/certain1/bob.axd", type="..." /> > <add verb="*" path="/files/certain2/bob.axd", type="..." /> > <add verb="*" path="/files/certain2/deeper/bob.axd", type="..." /> > > bill > > "Grant Harmeyer" <ne*@internetap ollo.com> wrote in message > news:eO******** ******@TK2MSFTN GP11.phx.gbl... >> How would I set up an httpHandler so that it would only apply to certain >> child directories of the application? >> >> I.E: >> <httpHandlers > >> <add verb="*" path="/files/*/*/*/*.aspx" >> type="App.HttpH andlers.ThreeDe epPage, App" /> >> <add verb="*" path="/files/*/*/*.aspx" >> type="App.HttpH andlers.TwoDeep Page, App" /> >> </httpHandlers> >> >> The wildcard character for a directory causes an error, and before I even >> tried it I thought it would. I am guessing I would probably have to do > this >> using a custom configSection, but I'm not sure how to do it. >> >> >> TIA, >> >> Grant >> >> > >
Yes, Handlers can "handle" child directories.
For each subdirectory, its full configuration should be done when each
subdirectory is set up as an application in IIS. If a subdirectory is not
set up as an application, it will pull it settings from the parent (root
application) directory. Each subdirectory can override its parent settings,
such as appSettings, etc. http://msdn.microsoft.com/library/de...chitecture.asp
Infact if you try to change the authentication mode for a non-application
subdirectory, it will not allow it. It will give you some "machine beyond
application configuration error".
bill
"Igor K" <ig**@exor.hr > wrote in message
news:e7******** ******@TK2MSFTN GP15.phx.gbl... Hi there, are you sure that HttpHandler is even able to handle child directories? I red somewhere that for each subdirectory it's own configuration should be done (I mean: bin directory, IIS configuration, web.config...).
Are you maybe mixing HttpModule with it?
Please correct me if I'm wrong,
Igor
"William F. Robertson, Jr." <wfrobertson_at _kpmg_dot_com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Okay, here is the path you want to take then.
<add verb="*" path="/files/Level1Handler.a xd", type="..." /> <add verb="*" path="/files/Level2Handler.a xd", type="..." />
In Global.cs, you will want to use HttpContext.Rew ritePath to achieve this.
Here is a test snippet I used. You might want to explore the Request object to see if there is a better way, but RawUrl works for demostration purposes.
protected void Application_Beg inRequest( object sender, EventArgs e ) { string url = Context.Request .RawUrl.ToUpper (); if ( url.EndsWith( "LEVEL1HANDLER. AXD" ) ) //this will covert "files/*/Level1Handler.a xd" { Context.Rewrite Path( "/files/Level1Handler.a xd" ); } else if ( url.EndsWith( "LEVEL2HANDLER. AXD" ) ) { Context.Rewrite Path( "/files/Level2Hanlder.a xd" ); } }
I hope this is what you are looking for. Or atleast you can use this to get where you are going.
bill
"Grant Harmeyer" <ne*@internetap ollo.com> wrote in message news:u$******** ******@TK2MSFTN GP11.phx.gbl... The directories will have dynamic names for years, months and days.
Also, the file names will be dynamic (managed by a file system of sorts that
I don't have much control over).
i.e: <add verb="*" path="/files/2004/10/7/SomeFile.axd", type="..." /> <add verb="*" path="/files/2004/12/15/SomeFile2.axd", type="..." />
Considering that I have no idea how many files there may be or what the 2nd or 3rd level directory names may be, I was hoping to use wildcards to achieve this. It's an odd problem I know.
Grant
"William F. Robertson, Jr." <wfrobertson_at _kpmg_dot_com> wrote in message news:On******** *****@TK2MSFTNG P12.phx.gbl... > Why don't you just list them out? > > <add verb="*" path="/files/certain1/bob.axd", type="..." /> > <add verb="*" path="/files/certain2/bob.axd", type="..." /> > <add verb="*" path="/files/certain2/deeper/bob.axd", type="..." /> > > bill > > "Grant Harmeyer" <ne*@internetap ollo.com> wrote in message > news:eO******** ******@TK2MSFTN GP11.phx.gbl... >> How would I set up an httpHandler so that it would only apply to certain >> child directories of the application? >> >> I.E: >> <httpHandlers > >> <add verb="*" path="/files/*/*/*/*.aspx" >> type="App.HttpH andlers.ThreeDe epPage, App" /> >> <add verb="*" path="/files/*/*/*.aspx" >> type="App.HttpH andlers.TwoDeep Page, App" /> >> </httpHandlers> >> >> The wildcard character for a directory causes an error, and before I even >> tried it I thought it would. I am guessing I would probably have to
do > this >> using a custom configSection, but I'm not sure how to do it. >> >> >> TIA, >> >> Grant >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: some guy with a computer |
last post by:
I can not get a custom httpHandler to fire using machine.config and an
assembly in the GAC.
It will not work if I move the assembly to the GAC, even though I have it
referenced correctly and add the assembly to the <compile> tag (all my other
controls I can call from the GAC this way).
It will not work if I have the handler specified where the rest are (*.cs,
*.aspx.....etc, in machine.config)
|
by: Luis |
last post by:
Hi,
I want to protected all files in my website, so I try to use httpHandlers, I put this in my WEB.CONFIG (at the end of page), but I can't protected the files type MDB, CSB, can someone help me? :
<httpHandlers>
<add verb="*" path="*.mdb" type="System.Web.HttpForbiddenHandler" />
<add verb="*" path="*.csv" type="System.Web.HttpForbiddenHandler" />
|
by: Chance Hopkins |
last post by:
Does anyone know how to get a custom httpHandler to fire for all applications in machine.config for an assembly in the GAC, without
using seperate location tags?
For instance, this works for a single domain:
<location path="mydomain.com" allowOverride="false" >
<system.web>
<httpHandlers>
<add verb="*" path="*.mycustomExtension" type="MyCustomClass,MyDLL, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=47922ba823051f3f, Custom=null"...
|
by: Patrick Kristiansen |
last post by:
Hi!
I have on my website a root web.config file, and also created a
subapplication "/publikationer". In my root web.config I've specified
an HTTP-handler for some requests, but this is mirrored in my
subapplication. Eventhough I <clear /> my HTTP-handlers it doesn't
seem to work, and it still gives me an error about an assembly not
found. It should not use this certain HTTP-handler in my
subapplication.
|
by: TJoker .NET |
last post by:
I have this web control that need to process some special
urls requested by the browser. So I created a class
implementing IHttpHandler to deal with it.
The problem here is that to properly use the control, the
developer has to include something like the following in
his web.config:
<httpHandlers>
<add verb="*" path="MySpecialResource.ashx"
type="MyRequestHandler, MyAssembly"/>
| |
by: MWells |
last post by:
I'm having an issue getting my HttpHandlers and HttpModules to play together
nicely.
My HttpHandlers take special document types (defined by extension) and
process them specially. I might have an HttpHandler installed to render
Excel files as HTML, or to render TIFFs to JPEGs, etc.
The HttpModules are used for Uri handling, so that a request for a resource
like;
|
by: tshad |
last post by:
I have 2 controls that I need to run that I got of the Web. I have been
using ScrollKeeper for awhile and was trying to add FreeTextBox to my site.
But for some reason it won't run if ScrollKeeper is there.
Here is my Web.Config file:
<configuration>
<system.web>
<customErrors mode="Off" />
<httpModules>
|
by: Anonieko |
last post by:
HttpHandlers - Learn Them. Use Them.
Introduction
There are many features in ASP.NET that are unfortunately underused.
Sometimes a feature gets looked over because it's too complicated.
Other times, like in the case of HttpHandlers, it's because they are
poorly understood. For the longest time I understood the concept and
|
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= |
last post by:
Hi;
We return files that are stored in our database using an httpHandler as
follows:
<httpHandlers>
<add verb="*" path="report-view.*" type="ReportView"/>
</httpHandlers>
Now as I understand it, we can make the path "filename.*" and we can make it
"abc*.*". But we cannot make it "files\*" or "files\*.rtf".
|
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: 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...
| |
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: 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: 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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: 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...
| |