advertisement

Forum => Article discussions => Use an HttpHandler to stop bandwidth leeching of your images

Jump to:

Next Oldest | Next Newest

1/19/2004 6:29:28 PM Link | Reply | Edit | Quote

uber:ASP.Net

Location: | Joined: 1/1/2000 | Posts: 12 | Online

Article discussion for:
Use an HttpHandler to stop bandwidth leeching of your images

11/2/2004 12:58:27 AM Link | Reply | Edit | Quote

CactusJuice

Profile Send Private Message Send E-Mail Web Site
Location: Phoenix, AZ | Joined: 9/5/2004 | Posts: 107 | Offline

Parser Error Message: File or assembly name JpgHandler.dll, or one of its dependencies, was not found.

Line 7:   
Line 8:
>>Line 9:
Line 10:
Line 11:

The error is on line 9, no other clues. My site did not have a "/bin" folder (off the root) so I created one, and copied my newly compiled dll "JpgHandler.dll" into that bin folder. I then added the above lines to my web.config. Then rebuilt solution. What am I missing?...anyone, anyone...Bueller...Bueller?

Cameron *** Edited 11/2/2004 5:59:55 AM UTC by CactusJuice*** *** Edited 11/2/2004 6:00:53 AM UTC by CactusJuice*** *** Edited 11/2/2004 1:35:03 PM UTC by CactusJuice***

11/2/2004 9:33:05 PM Link | Reply | Edit | Quote

CactusJuice

Profile Send Private Message Send E-Mail Web Site
Location: Phoenix, AZ | Joined: 9/5/2004 | Posts: 107 | Offline

I dunno what's happening. I got rid of the errors. But the filter isn't working. For example I can cut/paste the URL into the browser and the image is still served up. Except for the domain name I pretty much cut and pasted this article's code verbatim. Weird. I'll keep playing around with it.

And locally. It does work sort of. When the page loads up the image is broken if it's not good referer (the no.jpg is not shown). And if I try to cut/past the url I get an error:
Could not find file "c:\inetpub\wwwroot\no.jpg".

Which doesn't make any sense because it should be looking for "c:\inetpub\wwwroot\mydomain\no.jpg".

11/2/2004 9:39:35 PM Link | Reply | Edit | Quote

Jeff

Profile Send Private Message Send E-Mail Web Site AOL Instant Message Yahoo Instant Message ICQ Message
Location: Cleveland, OH, USA | Joined: 8/15/2000 | Posts: 813 | Offline

The browser is probably caching it. I've had that happen to me, and checking in a new browser instance worked.


Jeff 'Jones' Putz
POP World Media, LLC
Maximizing ASP.NET

11/3/2004 9:12:30 PM Link | Reply | Edit | Quote

CactusJuice

Profile Send Private Message Send E-Mail Web Site
Location: Phoenix, AZ | Joined: 9/5/2004 | Posts: 107 | Offline

Thanks. The web host stop/started the services on the server and the custom HttpHandler started working. But about 12 hours later now it's not filter again. Appears to be something on thier end.

6/3/2005 11:45:04 AM Link | Reply | Edit | Quote

Naren

Profile Send Private Message Send E-Mail
Location: | Joined: 6/3/2005 | Posts: 1 | Offline

Regarding the HTTPHandler, is it possible to dynamically enable and disable the handler, through coding?

To be more specific, I need to have a web interface to enable the HTTPHandler and disable the same, instead of having an entry in the web.config file.

Is it possible?

6/3/2005 2:41:16 PM Link | Reply | Edit | Quote

CactusJuice

Profile Send Private Message Send E-Mail Web Site
Location: Phoenix, AZ | Joined: 9/5/2004 | Posts: 107 | Offline

Sure, from your web interface you could set the value of bool variable for examp;le. Then wrap your IHttpHandler logic in an If/Then type of statment.

IF boolUseHandler

THEN process the code block that serves up the requested image file name.

ELSE process the code block that servers up your leech.jpg

7/11/2005 12:22:37 PM Link | Reply | Edit | Quote

MorningZ

Profile Send Private Message Send E-Mail
Location: | Joined: 7/11/2005 | Posts: 2 | Offline

** Edit of bunch of code i posted **

Just a "gotcha" i ran across, i had:

httpHandlers>
verb="*" path="~/content/*.aspx" type="MapURL" />
httpHandlers>

it didn't work until i changed it to

httpHandlers>
verb="*" path="~/content/*.aspx" type="MapURL,__Code" />
httpHandlers>

then it worked...

now... i am just wanting to rewrite *.aspx requests in the root of the application, not of any aspx files one folder or deeper in the app, suggestions on doing this?

*** Edited 7/11/2005 4:34:46 PM UTC by MorningZ***

7/11/2005 6:13:53 PM Link | Reply | Edit | Quote

Jeff

Profile Send Private Message Send E-Mail Web Site AOL Instant Message Yahoo Instant Message ICQ Message
Location: Cleveland, OH, USA | Joined: 8/15/2000 | Posts: 813 | Offline

If you want to just work right out of the root, change the path to *.aspx.


Jeff 'Jones' Putz
POP World Media, LLC
Maximizing ASP.NET

7/13/2005 12:28:43 PM Link | Reply | Edit | Quote

du8die

Profile Send Private Message Send E-Mail
Location: Southeast Wisconsin | Joined: 1/16/2004 | Posts: 126 | Offline

MorningZ said:
** Edit of bunch of code i posted **

Just a "gotcha" i ran across, i had:

httpHandlers>
verb="*" path="~/content/*.aspx" type="MapURL" />
httpHandlers>

it didn't work until i changed it to

httpHandlers>
verb="*" path="~/content/*.aspx" type="MapURL,__Code" />
httpHandlers>

then it worked...

In Whidbey, you don't have to reference the namespace of the dll. In v1.1, you do.

d8


The cause of the problem is:
The POP server is out of Coke .

Forum => Article discussions => Use an HttpHandler to stop bandwidth leeching of your images

Please login or register to post.