我为我的应用程序设置了自定义错误页面:
<customErrors mode="On" defaultRedirect="~/errors/GeneralError.aspx"
/>
Run Code Online (Sandbox Code Playgroud)
在Global.asax,Application_Error()中,以下代码用于获取异常详细信息:
Exception ex = Server.GetLastError();
if (ex != null)
{
if (ex.GetBaseException() != null)
ex = ex.GetBaseException();
}
Run Code Online (Sandbox Code Playgroud)
当我到达我的错误页面(〜/ errors/GeneralError.aspx.cs)时,Server.GetLastError()为null
有没有什么办法可以在错误页面上获取异常详细信息,而不是在Global.asax.cs中?
Vista/IIS7上的ASP.NET 3.5
我经常收到Client Disconnected消息.我不使用负载平衡 - 只有一个IIS服务器.我需要知道导致这种情况的原因以及如何解决这个问题.
这是异常信息:
Type: System.Web.HttpException
Message: The client disconnected.
Exception Data:
Source: System.Web
TargetSite: Void ThrowError(System.Exception, System.String, System.String, Boolean)
StackTrace:
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Run Code Online (Sandbox Code Playgroud) 我可以编写什么ASP.NET页面生命周期事件来确定发送的视图状态的大小?此外,是否可以在不解析渲染的HTML(如页面对象上的属性)的情况下确定大小,还是解析唯一的方法?
我想要做的是记录尺寸,特别是如果它们超过某个阈值.