RE: problem with httpmodule



Hi Gorge,

Are you using IIS 6 or any newer version of IIS?

For IIS6 or former version, only those ASP.NET specific document
extensions (such as .aspx, .ashx, .ascx ....) are forwarded to ASP.NET
runtime for processing. Those static content such as txt, htm, css or image
files are directly served by IIS server(for performance consideration).

If you want to let ASP.NET runtime process them, you can manually modify
the extension mapping for your ASP.NET web application's virtual directory.
Here is a tech article discusses on this:

#Configure IIS for Wildcard Extensions in ASP.NET
http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-
Extensions-in-ASP.NET.aspx

If you have anything unclear, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Gorge" <a@xxxxx>
Subject: problem with httpmodule
Date: Thu, 4 Jun 2009 13:27:48 +1200


Now when viewing the image I get a link... so the code isn't work at all
for images if I point it to this dll. Is this the correct way I should be
doing it?

I'm quite lost. I thought the httpmodule would intercept any request to
the
website.

Thanks



Code


a.. public class CountryFilter : IHttpModule
a.. {
a.. public void Dispose()
a.. {
a.. }
a..
a.. public void Init(HttpApplication context)
a.. {
a.. context.BeginRequest += new EventHandler(context_BeginRequest);
a.. }
a..
a.. private void context_BeginRequest(object sender, EventArgs e)
a.. {
a..
a.. HttpApplication app = (HttpApplication)sender;
a.. HttpContext context = ((HttpApplication)sender).Context;
a..
a.. // start checking country code
a.. GeoIPCountry cl = new GeoIPCountry(@"c:\\GeoIP.dat");
a..
a.. if
(cl.GetCountryCode(IPAddress.Parse(app.Context.Request.ServerVariables["REM
OTE_ADDR"]))
!= "NZ")
a.. {
a.. context.Response.StatusCode = 403;
a.. context.Response.End();
a.. }
a.. }
a.. }




.



Relevant Pages

  • Re: Howto refresh IIS 6 Application pool identity credential info
    ... As soon as a new request to the corresponding web site which the AppPool ... IIS W3SVC service will then start up a new worker ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.inetserver.iis.security)
  • RE: Error with Getting Started Sample from WCF
    ... IIS. ... Host a WCF Service in IIS ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.distributed_apps)
  • RE: Reporting Services on x64
    ... does that mean that IIS will never be able to benefit from the ... use reporting services configuration manager to configure: ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sqlserver.setup)
  • RE: Problem with SQL trusted connection.
    ... you could still configure Windows authentication in IIS 7 ... use in IIS6: ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sqlserver.security)
  • RE: MoveNext() method not covered by unit testing?
    ... public void ItemsConstructorTest() ... coverage. ... Microsoft Online Community Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.vsnet.enterprise.tools)