<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="devExpress">
<section name="themes" type="DevExpress.Web.ThemesConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
<section name="compression" type="DevExpress.Web.CompressionConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
<section name="settings" type="DevExpress.Web.SettingsConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
<section name="errors" type="DevExpress.Web.ErrorsConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="DevExpress.Data.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="DevExpress.Printing.v14.2.Core, Version=14.2.3.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<pages validateRequest="false">
</pages>
<customErrors redirectMode="ResponseRedirect" defaultRedirect="~/ErrorPage.aspx" mode="On">
<error statusCode="500" redirect="~/ErrorPage.aspx" />
</customErrors>
<httpModules>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</httpModules>
<httpHandlers>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" validate="false" />
</httpHandlers>
</system.web>
<system.webServer>
<modules>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" name="ASPxHttpHandlerModule" preCondition="integratedMode" />
</handlers>
</system.webServer>
<devExpress>
<themes enableThemesAssembly="true" styleSheetTheme="" theme="" customThemeAssemblies="" />
<compression enableHtmlCompression="false" enableCallbackCompression="true" enableResourceCompression="true" enableResourceMerging="true" />
<settings doctypeMode="Xhtml" rightToLeft="false" embedRequiredClientLibraries="false" ieCompatibilityVersion="edge" />
<errors callbackErrorRedirectUrl="~/ErrorPage.aspx" />
</devExpress>
</configuration>
using System;
using System.Web;
using System.Web.UI;
public partial class _Default: Page {
protected void Page_Load(object sender, EventArgs e) {
if (HttpContext.Current.Session["Log"] == null)
HttpContext.Current.Session["Log"] = "";
}
protected void CallbackControl_Callback(object source, DevExpress.Web.CallbackEventArgs e) {
Exception innerException = new Exception("NoReport");
throw new Exception("This Exception is thrown to demonstrate the ASPxWebControl.CallbackError Event.", innerException);
}
}
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="DevExpress.Web" %>
<script RunAt="server">
void Application_Start(object sender, EventArgs e) {
// Assign Application_Error as a callback error handler
ASPxWebControl.CallbackError += new EventHandler(Application_Error);
}
void Application_Error(object sender, EventArgs e) {
// Use HttpContext.Current to get a Web request processing helper
HttpServerUtility server = HttpContext.Current.Server;
Exception exception = server.GetLastError();
if (exception is HttpUnhandledException)
exception = exception.InnerException;
// Log an exception
AddToLog(exception.Message, exception.StackTrace);
}
void AddToLog(string message, string stackTrace) {
StringBuilder sb = new StringBuilder();
sb.AppendLine(DateTime.Now.ToLocalTime().ToString());
sb.AppendLine(message);
sb.AppendLine();
sb.AppendLine("Source File: " + HttpContext.Current.Request.RawUrl);
sb.AppendLine();
sb.AppendLine("Stack Trace: ");
sb.AppendLine(stackTrace);
for (int i = 0; i < 150; i++)
sb.Append("-");
sb.AppendLine();
HttpContext.Current.Session["Log"] += sb.ToString();
sb.AppendLine();
}
</script>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxButton ID="Button" runat="server" Text="Throw Exception on Callback" AutoPostBack="False" Width="120px">
<ClientSideEvents Click="function(s, e) { CallbackControl.PerformCallback(); }" />
</dx:ASPxButton>
<dx:ASPxCallback ID="CallbackControl" ClientInstanceName="CallbackControl" runat="server" OnCallback="CallbackControl_Callback">
</dx:ASPxCallback>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ErrorPage.aspx.cs" Inherits="Default2" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:LinkButton ID="BackLinkButton" runat="server" Text="Back to Example" PostBackUrl="~/Default.aspx"></asp:LinkButton><br />
<br />
Error log:
<dx:ASPxMemo ID="Memo" runat="server" Height="500px" Width="100%">
</dx:ASPxMemo>
<asp:LinkButton ID="ClearLinkButton" runat="server" Text="Clear" OnClick="ClearLinkButton_Click"></asp:LinkButton>
</form>
</body>
</html>
using System;
using System.Web;
public partial class Default2: System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if (HttpContext.Current.Session["Log"] != null)
Memo.Text = HttpContext.Current.Session["Log"].ToString();
}
protected void ClearLinkButton_Click(object sender, EventArgs e) {
HttpContext.Current.Session["Log"] = "";
Memo.Text = "";
}
}
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxButton ID="Button" runat="server" Text="Throw Exception on Callback" AutoPostBack="False" Width="120px">
<ClientSideEvents Click="function(s, e) { CallbackControl.PerformCallback(); }" />
</dx:ASPxButton>
<dx:ASPxCallback ID="CallbackControl" ClientInstanceName="CallbackControl" runat="server" OnCallback="CallbackControl_Callback">
</dx:ASPxCallback>
</form>
</body>
</html>
Imports System
Imports System.Web
Partial Public Class Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If HttpContext.Current.Session("Log") IsNot Nothing Then
Memo.Text = HttpContext.Current.Session("Log").ToString()
End If
End Sub
Protected Sub ClearLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs)
HttpContext.Current.Session("Log") = ""
Memo.Text = ""
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="ErrorPage.aspx.vb" Inherits="Default2" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:LinkButton ID="BackLinkButton" runat="server" Text="Back to Example" PostBackUrl="~/Default.aspx"></asp:LinkButton><br />
<br />
Error log:
<dx:ASPxMemo ID="Memo" runat="server" Height="500px" Width="100%">
</dx:ASPxMemo>
<asp:LinkButton ID="ClearLinkButton" runat="server" Text="Clear" OnClick="ClearLinkButton_Click"></asp:LinkButton>
</form>
</body>
</html>
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="devExpress">
<section name="themes" type="DevExpress.Web.ThemesConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
<section name="compression" type="DevExpress.Web.CompressionConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
<section name="settings" type="DevExpress.Web.SettingsConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
<section name="errors" type="DevExpress.Web.ErrorsConfigurationSection, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="DevExpress.Data.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="DevExpress.Printing.v14.2.Core, Version=14.2.3.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<pages validateRequest="false">
</pages>
<customErrors redirectMode="ResponseRedirect" defaultRedirect="~/ErrorPage.aspx" mode="On">
<error statusCode="500" redirect="~/ErrorPage.aspx" />
</customErrors>
<httpModules>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</httpModules>
<httpHandlers>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" validate="false" />
</httpHandlers>
</system.web>
<system.webServer>
<modules>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.v14.2, Version=14.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" name="ASPxHttpHandlerModule" preCondition="integratedMode" />
</handlers>
</system.webServer>
<devExpress>
<themes enableThemesAssembly="true" styleSheetTheme="" theme="" customThemeAssemblies="" />
<compression enableHtmlCompression="false" enableCallbackCompression="true" enableResourceCompression="true" enableResourceMerging="true" />
<settings doctypeMode="Xhtml" rightToLeft="false" embedRequiredClientLibraries="false" ieCompatibilityVersion="edge" />
<errors callbackErrorRedirectUrl="~/ErrorPage.aspx" />
</devExpress>
</configuration>
<%@ Application Language="vb" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="DevExpress.Web" %>
<script RunAt="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Assign Application_Error as a callback error handler
AddHandler ASPxWebControl.CallbackError, AddressOf Application_Error
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Use HttpContext.Current to get a Web request processing helper
Dim exception As Exception = HttpContext.Current.Server.GetLastError()
If TypeOf exception Is HttpUnhandledException Then
exception = exception.InnerException
End If
' Log an exception
AddToLog(exception.Message, exception.StackTrace)
End Sub
Sub AddToLog(ByVal message As String, ByVal stackTrace As String)
Dim sb As New StringBuilder()
sb.AppendLine(Date.Now.ToLocalTime().ToString())
sb.AppendLine(message)
sb.AppendLine()
sb.AppendLine("Source File: " & HttpContext.Current.Request.RawUrl)
sb.AppendLine()
sb.AppendLine("Stack Trace: ")
sb.AppendLine(stackTrace)
For i As Integer = 0 To 149
sb.Append("-")
Next i
sb.AppendLine()
HttpContext.Current.Session("Log") += sb.ToString()
sb.AppendLine()
End Sub
</script>
Imports System
Imports System.Web
Imports System.Web.UI
Partial Public Class _Default
Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If HttpContext.Current.Session("Log") Is Nothing Then
HttpContext.Current.Session("Log") = ""
End If
End Sub
Protected Sub CallbackControl_Callback(ByVal source As Object, ByVal e As DevExpress.Web.CallbackEventArgs)
Dim innerException As New Exception("NoReport")
Throw New Exception("This Exception is thrown to demonstrate the ASPxWebControl.CallbackError Event.", innerException)
End Sub
End Class