/// <summary> /// Designed for MVC applications. They pass the controller trace context /// </summary> /// <param name="ctx"></param> /// <param name="cmd"></param> /// <param name="actionName"></param> public static void TraceOracleCommand(TraceContext ctx, DbCommand cmd, string actionName) { if (ctx == null) { // This can happen during unit tests. Do nothing. return; } ctx.Write("QueryBegin", string.Format("{0:F} for Action {1}", DateTime.Now, actionName)); // Make sure that PersistSecurityInfo has not been set to true in the connection string. Otherwise, the password will be traced as well. // OracleDatastore takes the responsibility of explicitly setting PersistSecurityInfo=false. //ctx.Write("Connection String", cmd.Connection.ConnectionString); string str = string.Format("[{0}] {1}", cmd.CommandType, cmd.CommandText.Trim()); ctx.Write("QueryText", str); foreach (DbParameter param in cmd.Parameters) { if (param.Value == null) { str = string.Format("Parameter {0} -> null (null {1}) {2}", param.ParameterName, param.DbType, param.Direction); } else { str = string.Format("Parameter {0} -> {1} ({2} {3}) {4}", param.ParameterName, param.Value, param.Value.GetType(), param.DbType, param.Direction); } ctx.Write("QueryParameter", str); } return; }
public HttpContext (HttpRequest Request, HttpResponse Response) { Context = this; _oTimestamp = DateTime.Now; _oRequest = Request; _oResponse = Response; _oTrace = new TraceContext (this); }
/// <summary> /// Call this after query has finished executing to trace the query end time. /// Writes to Diagnostics if ctx is null /// </summary> /// <param name="ctx"></param> public static void TraceQueryEnd(TraceContext ctx) { if (ctx == null) { System.Diagnostics.Trace.WriteLine(DateTime.Now.ToString("F"), "QueryEnd"); } else { ctx.Write("QueryEnd", DateTime.Now.ToString("F")); } }
public void Constructor_Properties_Events () { TraceContext tc = new TraceContext (context); tc.IsEnabled = false; Assert.IsFalse (tc.IsEnabled, "IsEnabled"); Assert.AreEqual (TraceMode.SortByTime, tc.TraceMode, "TraceMode"); tc.TraceMode = TraceMode.Default; tc.TraceFinished += new TraceContextEventHandler (Handler); tc.TraceFinished -= new TraceContextEventHandler (Handler); }
private void Init(HttpRequest request, HttpResponse response) { _request = request; _response = response; _utcTimestamp = DateTime.UtcNow; Profiler p = HttpRuntime.Profile; if (p != null && p.IsEnabled) { _topTraceContext = new TraceContext(this); } }
internal void PushTraceContext() { if (_traceContextStack == null) { _traceContextStack = new Stack(); } // push current TraceContext on stack _traceContextStack.Push(_topTraceContext); // now make a new one for the top if necessary if (_topTraceContext != null) { TraceContext tc = new TraceContext(this); _topTraceContext.CopySettingsTo(tc); _topTraceContext = tc; } }
public void SetTrace(TraceContext val) { }
public void SetTrace(TraceContext val) { _trace = val; }
public HttpContext (HttpWorkerRequest WorkerRequest) { Context = this; _oTimestamp = DateTime.Now; _oRequest = new HttpRequest (WorkerRequest, this); _oResponse = new HttpResponse (WorkerRequest, this); _oWorkerRequest = WorkerRequest; _oTrace = new TraceContext (this); }
private void Init(HttpRequest request, HttpResponse response) { this._request = request; this._response = response; this._utcTimestamp = DateTime.UtcNow; if (this._wr is IIS7WorkerRequest) { this._isIntegratedPipeline = true; } if (!(this._wr is StateHttpWorkerRequest)) { this.CookielessHelper.RemoveCookielessValuesFromPath(); } Profiler profile = HttpRuntime.Profile; if ((profile != null) && profile.IsEnabled) { this._topTraceContext = new TraceContext(this); } string eurl = this.GetEurl(); if (!string.IsNullOrEmpty(eurl)) { string path = request.Path; int num = path.Length - eurl.Length; bool flag = path[path.Length - 1] == '/'; if (flag) { num--; } if ((num >= 0) && System.Web.Util.StringUtil.Equals(path, num, eurl, 0, eurl.Length)) { int length = num; if (flag) { length++; } string virtualPath = path.Substring(0, length); this.ConfigurationPath = null; this.Request.InternalRewritePath(VirtualPath.Create(virtualPath), null, true); } } }
internal void CopySettingsTo(TraceContext tc) { tc._traceMode = this._traceMode; tc._isEnabled = this._isEnabled; }
public TraceContextProxy(TraceContext traceContext) { _traceContext = traceContext; }
public AsyncDemo(HttpSessionState session, TraceContext trace) { m_Session = session; m_Trace = trace; }
internal void PopTraceContext() { Debug.Assert(_traceContextStack != null); _topTraceContext = (TraceContext) _traceContextStack.Pop(); }
/// <summary> /// Initializes a new instance of the <see cref="TraceAdapter"/> class. /// </summary> /// <param name="traceContext">The trace context.</param> public TraceAdapter(TraceContext traceContext) { trace = traceContext; }
public static void TraceOracleCommand(TraceContext ctx, DbCommand cmd) { TraceOracleCommand(ctx, cmd, "Unspecified Action"); }
internal void PopTraceContext() { Debug.Assert(_traceContextStack != null); _topTraceContext = (TraceContext)_traceContextStack.Pop(); }
internal void PushTraceContext() { if (this._traceContextStack == null) { this._traceContextStack = new Stack(); } this._traceContextStack.Push(this._topTraceContext); if (this._topTraceContext != null) { TraceContext tc = new TraceContext(this); this._topTraceContext.CopySettingsTo(tc); this._topTraceContext = tc; } }
internal void PopTraceContext() { this._topTraceContext = (TraceContext) this._traceContextStack.Pop(); }
protected TestHttpContext() : base() { // When overridden in a derived class, gets an array of errors (if any) that // accumulated when an HTTP request was being processed. TestRequest = null; TestResponse = null; TestServer = new TestHttpServer(); TestSession = null; trace = new TraceContext(HttpContext.Current); }
private void Init(HttpRequest request, HttpResponse response) { _request = request; _response = response; _utcTimestamp = DateTime.UtcNow; _principalContainer = this; if (_wr is IIS7WorkerRequest) { _isIntegratedPipeline = true; } if (!(_wr is System.Web.SessionState.StateHttpWorkerRequest)) CookielessHelper.RemoveCookielessValuesFromPath(); // This ensures that the cookieless-helper is initialized and // rewrites the path if the URI contains cookieless form-auth ticket, session-id, etc. Profiler p = HttpRuntime.Profile; if (p != null && p.IsEnabled) _topTraceContext = new TraceContext(this); // rewrite path in order to remove "/eurl.axd/guid", if it was // added to the URL by aspnet_filter.dll. string eurl = GetEurl(); if (!String.IsNullOrEmpty(eurl)) { string path = request.Path; int idxStartEurl = path.Length - eurl.Length; bool hasTrailingSlash = (path[path.Length - 1] == '/'); if (hasTrailingSlash) { idxStartEurl--; } if (idxStartEurl >= 0 && StringUtil.Equals(path, idxStartEurl, eurl, 0, eurl.Length)) { // restore original URL int originalUrlLen = idxStartEurl; if (hasTrailingSlash) { originalUrlLen++; } string originalUrl = path.Substring(0, originalUrlLen); // Dev10 835901: We don't call HttpContext.RewritePath(path) because the // original path may contain '?' encoded as %3F, and RewritePath // would interpret what follows as the query string. So instead, we // clear ConfigurationPath and call InternalRewritePath directly. ConfigurationPath = null; Request.InternalRewritePath(VirtualPath.Create(originalUrl), null, true); } } }
internal TraceContextAdapter(TraceContext target) { this.target = target; }
public static ITraceContext Cast(TraceContext context) { return new TraceContextProxy(context); }