Hi,
We have done the following:
In Appliction_Error and in ScriptManager_AsyncPostBackError, we handle and logs the exception.
Then we redirect to an error page.
When not using radcompression, this works for all cases, but when using radcompression, the redirect doesn't happen when an exception occurs in Page_PreInit. The exception must also be in an Async callback, normal postbacks works as expected.
Default.aspx:
Default.aspx.vb:
Error.aspx:
web.config:
Global.asax.vb:
When hitting the Error-button, I don't get to the error page, but when hitting the ErrorNoUpdatePanel I do get to the error page.
If turning off RadCompression both cases works.
Regards
Caesar
We have done the following:
In Appliction_Error and in ScriptManager_AsyncPostBackError, we handle and logs the exception.
Then we redirect to an error page.
When not using radcompression, this works for all cases, but when using radcompression, the redirect doesn't happen when an exception occurs in Page_PreInit. The exception must also be in an Async callback, normal postbacks works as expected.
Default.aspx:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="default.aspx.vb" Inherits="WebApplication8._default" %>
<!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"
>
<
div
>
<
asp:ScriptManager
ID
=
"sm"
runat
=
"server"
></
asp:ScriptManager
>
<
asp:UpdatePanel
ID
=
"upError"
runat
=
"server"
ChildrenAsTriggers
=
"true"
UpdateMode
=
"Conditional"
>
<
ContentTemplate
>
<
asp:Button
ID
=
"btnError"
runat
=
"server"
Text
=
"Error"
/>
</
ContentTemplate
>
</
asp:UpdatePanel
>
<
asp:Button
ID
=
"btnErrorNoUpdatePanel"
runat
=
"server"
Text
=
"ErrorNoUpdatePanel"
/>
</
div
>
</
form
>
</
body
>
</
html
>
Default.aspx.vb:
Public Class _default
Inherits System.Web.UI.Page
Private Sub _default_PreInit(sender As Object, e As System.EventArgs) Handles Me.PreInit
If Me.IsPostBack Then
Throw New Exception("Test")
End If
End Sub
Private Sub sm_AsyncPostBackError(sender As Object, e As System.Web.UI.AsyncPostBackErrorEventArgs) Handles sm.AsyncPostBackError
Server.ClearError()
Response.Redirect("Error.aspx")
End Sub
End Class
Error.aspx:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Error.aspx.vb" Inherits="WebApplication8._Error" %>
<!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"
>
<
div
>
An error occured!
</
div
>
</
form
>
</
body
>
</
html
>
web.config:
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
system.web
>
<
customErrors
mode
=
"Off"
/>
<
compilation
debug
=
"true"
strict
=
"false"
explicit
=
"true"
targetFramework
=
"4.0"
/>
<
httpModules
>
<
add
name
=
"RadCompression"
type
=
"Telerik.Web.UI.RadCompression"
/>
</
httpModules
>
</
system.web
>
<
system.webServer
>
<
modules
runAllManagedModulesForAllRequests
=
"true"
>
<
remove
name
=
"RadCompression"
/>
<
add
name
=
"RadCompression"
preCondition
=
"managedHandler"
type
=
"Telerik.Web.UI.RadCompression"
/>
</
modules
>
</
system.webServer
>
</
configuration
>
Global.asax.vb:
Imports System.Web.SessionState
Public Class Global_asax
Inherits System.Web.HttpApplication
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
Server.ClearError()
Response.Redirect("Error.aspx")
End Sub
End Class
When hitting the Error-button, I don't get to the error page, but when hitting the ErrorNoUpdatePanel I do get to the error page.
If turning off RadCompression both cases works.
Regards
Caesar