コード例 #1
0
ファイル: QueryLogging.cs プロジェクト: RavneetK/second-test
 /// <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;
 }
コード例 #2
0
		public HttpContext (HttpRequest Request, HttpResponse Response)
		{
			Context = this;

			_oTimestamp = DateTime.Now;
			_oRequest = Request;
			_oResponse = Response;
			_oTrace = new TraceContext (this);
		}
コード例 #3
0
ファイル: QueryLogging.cs プロジェクト: RavneetK/second-test
 /// <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"));
     }
 }
コード例 #4
0
ファイル: TraceContextCas.cs プロジェクト: Profit0004/mono
		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);
		}
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
		public void SetTrace(TraceContext val)
		{
		}
コード例 #8
0
		public void SetTrace(TraceContext val)
		{
			_trace = val;
		}
コード例 #9
0
		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);
		}
コード例 #10
0
 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);
         }
     }
 }
コード例 #11
0
 internal void CopySettingsTo(TraceContext tc)
 {
     tc._traceMode = this._traceMode;
     tc._isEnabled = this._isEnabled;
 }
コード例 #12
0
 public TraceContextProxy(TraceContext traceContext)
 {
     _traceContext = traceContext;
 }
コード例 #13
0
ファイル: AsyncDemo.cs プロジェクト: Letractively/henoch
 public AsyncDemo(HttpSessionState session, TraceContext trace)
 {
     m_Session = session;
     m_Trace = trace;
 }
コード例 #14
0
ファイル: HttpContext.cs プロジェクト: ItsVeryWindy/mono
 internal void PopTraceContext() {
     Debug.Assert(_traceContextStack != null);
     _topTraceContext = (TraceContext) _traceContextStack.Pop();
 }
コード例 #15
0
		/// <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;
		}
コード例 #16
0
ファイル: QueryLogging.cs プロジェクト: RavneetK/second-test
 public static void TraceOracleCommand(TraceContext ctx, DbCommand cmd)
 {
     TraceOracleCommand(ctx, cmd, "Unspecified Action");
 }
コード例 #17
0
 internal void PopTraceContext()
 {
     Debug.Assert(_traceContextStack != null);
     _topTraceContext = (TraceContext)_traceContextStack.Pop();
 }
コード例 #18
0
 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;
     }
 }
コード例 #19
0
 internal void PopTraceContext()
 {
     this._topTraceContext = (TraceContext) this._traceContextStack.Pop();
 }
コード例 #20
0
ファイル: HttpContext.cs プロジェクト: ItsVeryWindy/mono
        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;
            }
        }
コード例 #21
0
        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);
        }
コード例 #22
0
ファイル: HttpContext.cs プロジェクト: ItsVeryWindy/mono
        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);
                }
            }
        }
コード例 #23
0
 internal void CopySettingsTo(TraceContext tc) {
     tc._traceMode = this._traceMode;
     tc._isEnabled = this._isEnabled;
 }
コード例 #24
0
 internal TraceContextAdapter(TraceContext target)
 {
     this.target = target;
 }
コード例 #25
0
 public static ITraceContext Cast(TraceContext context)
 {
     return new TraceContextProxy(context);
 }