Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Debug.Assert and Trace.Assert and ASP.NET

Debug.Assert and Trace.Assert and ASP.NET

Scheduled Pinned Locked Moved ASP.NET
debuggingquestioncsharpasp-nethelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CillyMe
    wrote on last edited by
    #1

    I'm trying to get Debug/Trace Assert messages... but failed to do so. Here's a simple ASP.NET scripts with a textbox that responds to TextChanged event: <%@ Import Namespace="System" %> <%@ Import Namespace="System.Diagnostics" %> void OnTextChanged(object sender, EventArgs e) { int num_hit; object _num; _num = ViewState["num_hit"]; if(_num == null) { ViewState["num_hit"]=1; } else { num_hit= (int)_num; num_hit++; ViewState["num_hit"]=num_hit; Response.Write("Number of hit: " + num_hit + "<br>"); } //QUESTION 1: Nothing comes from this line here!? I have already configured web.config <compilation debug="true" /> Debug.Assert(false, "dummy message title", "dummy message retail!"); //OKAY, I can see the trace output at the bottom of the page under section "Trace Information" (I've configued <trace enabled="true" .../>) Trace.Write("trace"); //QUESTION 2: Compilation error: CS0117: 'System.Web.TraceContext' does not contain a definition for 'Assert'...? Trace.Assert(false, "dummy message title", "dummy message retail!"); return; } Function OnClientClick() End Function Test Codebehind

    Thanks in advance!

    R 1 Reply Last reply
    0
    • C CillyMe

      I'm trying to get Debug/Trace Assert messages... but failed to do so. Here's a simple ASP.NET scripts with a textbox that responds to TextChanged event: <%@ Import Namespace="System" %> <%@ Import Namespace="System.Diagnostics" %> void OnTextChanged(object sender, EventArgs e) { int num_hit; object _num; _num = ViewState["num_hit"]; if(_num == null) { ViewState["num_hit"]=1; } else { num_hit= (int)_num; num_hit++; ViewState["num_hit"]=num_hit; Response.Write("Number of hit: " + num_hit + "<br>"); } //QUESTION 1: Nothing comes from this line here!? I have already configured web.config <compilation debug="true" /> Debug.Assert(false, "dummy message title", "dummy message retail!"); //OKAY, I can see the trace output at the bottom of the page under section "Trace Information" (I've configued <trace enabled="true" .../>) Trace.Write("trace"); //QUESTION 2: Compilation error: CS0117: 'System.Web.TraceContext' does not contain a definition for 'Assert'...? Trace.Assert(false, "dummy message title", "dummy message retail!"); return; } Function OnClientClick() End Function Test Codebehind

      Thanks in advance!

      R Offline
      R Offline
      Rocky Moore
      wrote on last edited by
      #2

      The "Trace" you are picking up is probably the Page.Trace which is a TraceContext not a System.Diagnostics.Trace. The TraceContext does not have an Assert. Rocky <>< www.GotTheAnswerToSpam.com

      C 1 Reply Last reply
      0
      • R Rocky Moore

        The "Trace" you are picking up is probably the Page.Trace which is a TraceContext not a System.Diagnostics.Trace. The TraceContext does not have an Assert. Rocky <>< www.GotTheAnswerToSpam.com

        C Offline
        C Offline
        CillyMe
        wrote on last edited by
        #3

        Thanks, but is it possible to Assert in ASP.NET? I tried Debug.Assert. The application compiled with no error, but nothing showed in trace and no pop up occurred)...

        R 1 Reply Last reply
        0
        • C CillyMe

          Thanks, but is it possible to Assert in ASP.NET? I tried Debug.Assert. The application compiled with no error, but nothing showed in trace and no pop up occurred)...

          R Offline
          R Offline
          Rocky Moore
          wrote on last edited by
          #4

          CillyMe wrote: Thanks, but is it possible to Assert in ASP.NET? As far as asserting with a popup, were would it popup a message on a web server? In a Windows application you are assured there is usually a user sitting there in front of the computer. On a web server nobody is usually logged in to the server. I do not know of debugging with Assert popups in ASP.NET. You might need to make a trace listener to handle them. Rocky <>< www.GotTheAnswerToSpam.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups