Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HttpHandler trouble

Status
Not open for further replies.

vbkris

Programmer
Jan 20, 2003
5,994
IN
hi all,

i want to block the users from accessing certain extenstions like .swf in my site (not using IIS).

i want to know the best way to carry this out. currently i tries using HttpHandlers. it doesnt work.

My code:
Config code
<httpHandlers>
<add verb="*" path="*.swf" type="SwfHandler,SwfHandler" />
</httpHandlers>



My SWF handler code:

Imports System
Imports System.Configuration
Imports System.Web

Public Class SwfHandler
Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
Dim request As HttpRequest = context.Request
Dim response As HttpResponse = context.Response
response.redirect(" End Sub

Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class



some doubts:
I created a HttpModule prior to this. When i tried to use it in a sub folder's config file the <httpModule> tag didnt work. When i put it in the root folder's config file tag it worked. Am i doing anyting wrong???


Known is handfull, Unknown is worldfull
 
i forgot to mention my understanding of handlers:

1. user enters 2. the request goes to IIS
3. IIS hands it over to HttpHandler
4. Handler redirects the user.

Note: 1.swf acutally exists on the server...

Known is handfull, Unknown is worldfull
 
Is there a particular reason that you don't want to use IIS (i.e is it because you don't have access to IIS as it is a web hosting company that you are using)?

If so, then a lot of web hosting companies will do the work for you. They will configure IIS to map a .swf file to the ASP.NET ISAPI extension, then all you need to do is add the httpHandlers section to your web.config file.

If this is an option for you, see the following for more info:



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
>>is it because you don't have access to IIS as it is a web hosting company that you are using

yes


hmm, so only .ASPX files pass through IIS huh (is .axd a configured format cause it seems to work for .axd)...

Known is handfull, Unknown is worldfull
 
>>is it because you don't have access to IIS as it is a web hosting company that you are using

yes
In that case it may be worth asking if they will do what I suggested above.

hmm, so only .ASPX files pass through IIS huh (is .axd a configured format cause it seems to work for .axd)...
No, all extensions pass through IIS. IIS then uses it's application mappings list to see which file to call in order for the file to be handled.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
>>IIS then uses it's application mappings list to see which file to call in order for the file to be handled.

so is .axd listed?

i have an example for .axd (in a book). if the author is giving an example for .axd then it must be available to all IIS. just wanted to kown if u have used a file in that extension in .NET...

Known is handfull, Unknown is worldfull
 
Yes, axd files are handled by the aspnet_isapi.dll


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
thanks...

Known is handfull, Unknown is worldfull
 
Did you ever get this to work? It looks ok except the class name should be fully qualified including the namespace.
 
>> It looks ok except the class name should be fully qualified including the namespace

fully qualified?

like ca8msm said i had to change IIS handlers...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top