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 8204003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:45:17+00:00 2026-06-07T07:45:17+00:00

I have an HttpHandler mapped to aspnet_isapi.dll to perform a custom authentication check on

  • 0

I have an HttpHandler mapped to aspnet_isapi.dll to perform a custom authentication check on static files (.pdf files) using IIS 7.5 in Classic mode:

void IHttpHandler.ProcessRequest(HttpContext context)
{
  if(!User.IsMember) {
    Response.Redirect("~/Login.aspx?m=1");
   }
  else {
     //serve static content
   }
}

The above code works fine, except for the else statement logic. In the else statement, I simply want to allow the StaticFileHandler to process the request, but I haven’t been able to sort this out. Any suggestions on how to simply “hand off” the file back to IIS to serve the request as a normal StaticFile request, would be appreciated.

  • 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-07T07:45:19+00:00Added an answer on June 7, 2026 at 7:45 am

    To answer your question directly, you can create a StaticFileHandler and have it process the request:

    // Serve static content:
    Type type = typeof(HttpApplication).Assembly.GetType("System.Web.StaticFileHandler", true);
    IHttpHandler handler = (IHttpHandler)Activator.CreateInstance(type, true);
    handler.ProcessRequest(context);
    

    But a better idea might be to create an HTTP module instead of an HTTP handler:

    public class AuthenticationModule : IHttpModule
    {
        public void Dispose()
        {
        }
    
        public void Init(HttpApplication application)
        {
            application.AuthorizeRequest += this.Application_AuthorizeRequest;
        }
    
        private void Application_AuthorizeRequest(object sender, EventArgs e)
        {
            HttpContext context = ((HttpApplication)sender).Context;
            if (!User.IsMember)
                context.Response.Redirect("~/Login.aspx?m=1");      
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using IIS 6 on 2003. I have created a HTTP handler dll
I am trying to implement a Custom HttpHandler (for the first time), I have
I am using SubSonic 3.0.0.3 (the ActiveRecord approach) in an HttpHandler that I have
I have a HttpHandler that I'm using to handle certain images on a client's
I have created a HttpHandler for WMV files. I have also registered it in
I have the following HttpHandler; I'm using it to push updates to the browser
We have an HttpHandler that deals directly with binary posts over HTTP from custom
I have an assembly that acts as a custom HttpHandler (implements IHttpHandler and is
Background: I have created a custom HttpHandler which executes a particular command based on
We are using an asynchronous HttpHandler in ASP.NET 3.5 under IIS 6, and in

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.