/* * Finalize the request */ internal void EndRequest() { VerifyStart(); if (_endDataCollected) { return; } _endDataCollected = true; // add some more information about the reponse DataRow row = _requestData.Tables[SR.Trace_Request].Rows[0]; row[SR.Trace_Status_Code] = _context.Response.StatusCode; row[SR.Trace_Response_Encoding] = _context.Response.ContentEncoding.EncodingName; IEnumerator en; string temp; object obj; int i; // Application State info _context.Application.Lock(); try { en = _context.Application.GetEnumerator(); while (en.MoveNext()) { row = NewRow(_requestData, SR.Trace_Application_State); temp = (string)en.Current; //the key might be null row[SR.Trace_Application_Key] = (temp != null) ? temp : NULLSTRING; obj = _context.Application[temp]; // the value could also be null if (obj != null) { row[SR.Trace_Type] = obj.GetType(); row[SR.Trace_Value] = obj.ToString(); } else { row[SR.Trace_Type] = NULLSTRING; row[SR.Trace_Value] = NULLSTRING; } AddRow(_requestData, SR.Trace_Application_State, row); } } finally { _context.Application.UnLock(); } // cookie info HttpCookie[] cookies = new HttpCookie[_context.Request.Cookies.Count]; _context.Request.Cookies.CopyTo(cookies, 0); for (i = 0; i < cookies.Length; i++) { row = NewRow(_requestData, SR.Trace_Cookies_Collection); row[SR.Trace_Name] = cookies[i].Name; if (cookies[i].Values.HasKeys()) { NameValueCollection subvalues = cookies[i].Values; StringBuilder sb = new StringBuilder(); en = subvalues.GetEnumerator(); while (en.MoveNext()) { temp = (string)en.Current; sb.Append("("); sb.Append(temp + "="); sb.Append(cookies[i][temp] + ") "); } row[SR.Trace_Value] = sb.ToString(); } else { row[SR.Trace_Value] = cookies[i].Value; } int size = (cookies[i].Name == null) ? 0 : cookies[i].Name.Length; size += (cookies[i].Value == null) ? 0 : cookies[i].Value.Length; row[SR.Trace_Size] = size + 1; // plus 1 for = AddRow(_requestData, SR.Trace_Cookies_Collection, row); } HttpSessionState session = _context.Session; // session state info if (session != null) { row = _requestData.Tables[SR.Trace_Request].Rows[0]; row[SR.Trace_Session_Id] = session.SessionID; en = session.GetEnumerator(); while (en.MoveNext()) { row = NewRow(_requestData, SR.Trace_Session_State); temp = (string)en.Current; // the key could be null row[SR.Trace_Session_Key] = (temp != null) ? temp : NULLSTRING; obj = session[temp]; // the value could also be null if (obj != null) { row[SR.Trace_Type] = obj.GetType(); row[SR.Trace_Value] = obj.ToString(); } else { row[SR.Trace_Type] = NULLSTRING; row[SR.Trace_Value] = NULLSTRING; } AddRow(_requestData, SR.Trace_Session_State, row); } } ApplyTraceMode(); }
internal void SetSession(HttpSessionState state) { session_state = state; }
internal static void EndSession(HttpSessionState session, Object eventSource, EventArgs eventArgs) { _theApplicationFactory.FireSessionOnEnd(session, eventSource, eventArgs); }