Class Global
Base class for global.asax that supports EPiServer-specific features.
Inherited Members
Namespace: EPiServer
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public class Global : SiteBase
Remarks
The global.asax.cs file on an EPiServer site should inherit from Global. This is a requirement for the site to work.
Examples
The following code example demonstrates the usage of Global to read the BaseDiretory.
BaseDirectory:
<%= EPiServer.Global.BaseDirectory %>
Constructors
Global()
Initializes a new instance of the Global class.
Declaration
public Global()
Properties
BaseDirectory
The physical root directory where the site is installed, e.g. "D:/INetpub/WWWRoot/Example/", when using Internet Information Services (IIS) folder.
Declaration
public static string BaseDirectory { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Note: Slashes are used instead of backslashes.
DesignTimeLiveDataAvailable
Gets a value indicating whether the state of the global class has been initialized for design time environment and whether live data can be served.
Declaration
public static bool DesignTimeLiveDataAvailable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
InstanceName
IIS Metabase key path for the application, e.g. "_LM_W3SVC_1_ROOT_Example".
Declaration
public static string InstanceName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
note
Note: Underscore is used instead of slash.
IsDesignTime
Gets a value indicating whether execution takes place in a designer context.
Declaration
public static bool IsDesignTime { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsUnitTest
Gets a value indicating whether EPiServer is running under mstest.
Declaration
public static bool IsUnitTest { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
UrlRewriteProvider
Gets or sets the URL rewrite provider.
Declaration
public static UrlRewriteProvider UrlRewriteProvider { get; set; }
Property Value
Type | Description |
---|---|
UrlRewriteProvider | Instance of the URLRewriteProvider UrlRewriteProvider Type |
Remarks
Initial configuration of the UrlRewriteProvider is done from the Initialize method on InitializationModule. I e if running outside of a web server you must first call the INitialize method before you can read a valid value from this property.
Methods
GetVaryByCustomString(HttpContext, String)
Provides an application-wide implementation of the System.Web.UI.PartialCachingAttribute.VaryByCustom property.
Declaration
public override string GetVaryByCustomString(HttpContext context, string custom)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContext | context | An System.Web.HttpContext object that contains information about the current Web request. |
System.String | custom | The custom string that specifies which cached response is used to respond to the current request. |
Returns
Type | Description |
---|---|
System.String | If the value of the |
Global_PreRequestHandlerExecute(Object, EventArgs)
EPiServer support for restricting access to the UI folder and for precompiling .aspx files.
Declaration
protected virtual void Global_PreRequestHandlerExecute(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
Remarks
The "precompile" feature is really obsolete as of ASP.NET 2.0, but is retained for backwards compatibility.
HandleAccessDenied()
Handles the exception System.UnauthorizedAccessException globally by calling DefaultAccessDeniedHandler.
Declaration
protected virtual void HandleAccessDenied()
Remarks
Even though the method name and its base class suggests it would handle all access denied globally it will only be called for unhandled exceptions of type System.UnauthorizedAccessException
Init()
This Init method is called AFTER Application_Start and AFTER the Init methot on HttpModules Executes custom initialization code after all event handler modules have been added.
Declaration
public override void Init()
Remarks
Note! You cannot count on HttpContext being available - i e do NOT attempt to access it.
OnRoutesRegistered(RouteCollection)
Called to raise RoutesRegistered event.
Declaration
protected virtual void OnRoutesRegistered(RouteCollection routes)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Routing.RouteCollection | routes | The routes. |
OnRoutesRegistrating(RouteCollection)
Called to raise RoutesRegistrating event.
Declaration
protected virtual void OnRoutesRegistrating(RouteCollection routes)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Routing.RouteCollection | routes | The routes. |
RegisterRoutes(RouteCollection)
Register all the routes needed in order for it to be possible to create CMS templates using MVC. Override this method if you want to replace our routes with custom ones.
Declaration
protected virtual void RegisterRoutes(RouteCollection routes)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Routing.RouteCollection | routes | The global collection of routes that is used to lookup the route to a controller/action. |
Events
RoutesRegistered
Occurs after the CMS content routes are registered. Routes can be accessed through property Routes on event argument.
Declaration
public static event EventHandler<RouteRegistrationEventArgs> RoutesRegistered
Event Type
Type | Description |
---|---|
System.EventHandler<RouteRegistrationEventArgs> |
RoutesRegistrating
Occurs before the CMS content routes are registered. Routes can be accessed through property Routes on event argument.
Declaration
public static event EventHandler<RouteRegistrationEventArgs> RoutesRegistrating
Event Type
Type | Description |
---|---|
System.EventHandler<RouteRegistrationEventArgs> |