public void Init(PageAbstract page, WebSetting.WebSettingItem webSetting, HTMLContainer container) { _threadEntity = page._threadEntity; _server = page._server; _updateLocalCache = page._updateLocalCache; _request = page._request; _pageData = page._pageData; _pageSession = page._pageSession; _url = page._url; _webSetting = webSetting; _response = page._response; _response.SetNewContainer(container); _htmlContainer = container; }
private string _buildErrorString(Page.PageAbstract _page, Exception ex) { StringBuilder _errorString = new StringBuilder(); Exception exception = ex; _errorString.Append("WrongTime:").AppendLine(DateTime.Now.ToString()); _errorString.Append("ClientIP:").AppendLine(_page.Request.UserHostAddress); _errorString.Append("ClientBrowser:").AppendLine(string.Format("{0} | {1}", _page.Request.Browser.Type, _page.Request.Browser.Browser)); _errorString.Append("UserAgent:").AppendLine(_page.Request.UserAgent); _errorString.Append("URL:").AppendLine(_page.Request.Url.ToString()); _errorString.Append("Message:").AppendLine(exception.Message); Exception inex = exception; int i = 1; while (inex != null) { _errorString.AppendLine("=============================Exception No." + i++ + "============================="); _errorString.AppendLine("Message:" + inex.Message); _errorString.AppendLine("Source:" + inex.Source); _errorString.AppendLine("TargetSite:" + inex.TargetSite); StringBuilder _tsb = new StringBuilder(); if (inex.Data != null) { foreach (object _entry in inex.Data.Keys) { _tsb.Append(string.Format("{0}:{1}" + Environment.NewLine, _entry.ToString(), inex.Data[_entry])); } _errorString.AppendLine("Data:" + _tsb.ToString()); } _errorString.AppendLine("StackTrace:" + inex.StackTrace); inex = inex.InnerException; } return(_errorString.ToString()); }