Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7889869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:12:29+00:00 2026-06-03T06:12:29+00:00

I have an ISAPI filter written for IIS6. I now need to write a

  • 0

I have an ISAPI filter written for IIS6. I now need to write a wrapper for IIS7 to wrap the IIS6 filter. I plan to write HTTP module in C# and Pinvoke the unmanaged dll methods.

I need C# representation of the following code,

DWORD WINAPI HttpFilterProc(
   PHTTP_FILTER_CONTEXT pfc,
   DWORD notificationType,
   LPVOID pvNotification
);

    typedef struct _HTTP_FILTER_CONTEXT HTTP_FILTER_CONTEXT {
       DWORD cbSize;
       DWORD Revision;
       PVOID ServerContext;
       DWORD ulReserved;
       BOOL fIsSecurePort;
       PVOID pFilterContext;
       BOOL GetServerVariable;
       BOOL AddResponseHeaders;
       BOOL WriteClient;
       VOID * AllocMem;
       BOOL ServerSupportFunction;
    } HTTP_FILTER_CONTEXT, * PHTTP_FILTER_CONTEXT;

I tried using PInvoke Assistant from codeplex but i am not able to make it work.
Has anyone done anything like this before?
Can anyone provide a solution to the above?

Correction: Correct structure added

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:12:30+00:00Added an answer on June 3, 2026 at 6:12 am

    Building on the code in your answer you need to use the following:

    [DllImport(@"XyzISAPI.dll")]
    public static extern uint HttpFilterProc(
        ref HttpFilterContext pfc, 
        uint notificationType, 
        IntPtr pvNotification
    );
    

    The native code is passed a pointer to the context struct and passing the struct by ref is the easy way to match that. The final parameter is LPVOID, which is void* and that is plain IntPtr in managed code.

    As for HTTP_FILTER_ACCESS_DENIED, define it like this:

    [StructLayout(LayoutKind.Sequential)]
    public struct HttpFilterAccessDenied
    {
        IntPtr URL;
        IntPtr PhysicalPath;
        uint Reason;
    }
    

    You can then obtain one of those like this:

    HttpFilterAccessDenied hfad = (HttpFilterAccessDenied)Marshal.PtrToStructure(
        pvNotification, typeof(HttpFilterAccessDenied));
    

    And then you can get hold of the string values from the struct with Marshal.PtrToStringUni or Marshal.PtrToStringAnsi.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ISAPI filter that runs on IIS6 or 7. When there are
I have an ISAPI filter that I am using to do URL rewriting for
I have an ISAPI Application in Delphi 6 that uses WebBroker. I need to
I have developed an isapi web service in delphi 7 and I need to
I noticed that asp.net 4.0 now installs a top-level isapi plugin (in iis6), such
This code snippet is part of an isapi redirect filter written in managed c++
I have an old isapi application that I am now replacing with a new
I have an application implemented as an ISAPI filter whose behavior needs to change
I'm writing an ISAPI filter for the IIS7 that should map some functionalities of
I have a webservice compiled into a ISAPI module (dll). I have Apache 2.3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.