How do I access properties from global.asax in some other page's code behind

minty picture minty · Oct 30, 2008 · Viewed 25.7k times · Source

Imagine I have a property defined in global.asax.

public List<string> Roles
{
    get
    {
        ...
    }
    set
    {
        ...
    }
}

I want to use the value in another page. how to I refer to it?

Answer

Panos picture Panos · Oct 30, 2008

You can access the class like this:

((Global)this.Context.ApplicationInstance).Roles