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

Generating all combinations without repetition using MATLAB

matlab combinations

i have 4 sets each contain 6 elements from which I want to generate all possible vectors of size 8 were the first two elements are from set1 second 2 from set2 third 2 from set3 forth 2 from set4 w...

MySQL ORDER BY Send first to last

mysql sql list order

I managed to properly order my list using this trick, using UNSIGNED variable but the output has a single issue, it places the only entry starting with a letter before the digit entries. (sorting by

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.