How can I set Async="true" for all pages?

.net, asp.net, c#, webforms

Solution

You can set it in the master page like this. Found solution here:

public abstract class MyBasePage : System.Web.UI.Page
{
    public MyBasePage()
    {
        this.AsyncMode = true;
    }
}

Then change the inheritance in the aspx.cs file to something like this:

public partial class WebForm1 : MyBasePage

It can break the system when you set the `AsyncMode` property in anything else then the constructor.

Problem

I am sending emails asynchronous using ASP.NET. I noticed that I have to set "Async = true" in the View. The master page doesn't support this property. How can I set Async for all pages?

Original source