What event should I use in the IHttpModule to disable website?

I want to disable a website programatically for licensing reasons, and I want to do it in a httpmodule.

Ive tried to redirect the context :

public void Init(HttpApplication context)
{
    context.Response.Redirect("http://vls.pete.videolibraryserver.com");
}

But I get the error:

Response is not available in this context.

Anybody know how I can effectively disable the website and preferably send them to a custom page.

Answers


you can use BeginRequest event for redirection, like following:

public void Init(HttpApplication context)
{
    context.BeginRequest += new EventHandler(context_BeginRequest);
}

void context_BeginRequest(object sender, EventArgs e)
{
    HttpApplication application = (HttpApplication)sender;
    application.Context.Response.Redirect("http://vls.pete.videolibraryserver.com");
}

Need Your Help

Bind Control to SubClass

c# asp.net binding

I have a checkbox that I want to bind to a subclass. The DataSource uses the ParentClass as the business object. Is it possible? Something like:

Turn on/off GPS programmatically without prompting the user in iphone

iphone objective-c ios

I'm planning to code an application for the times when someone's iphone is lost or stolen. So it needs to tell the location of the phone via GPS, but in case it's stolen, it wouldn't be a good idea...