The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Debugging Client-Side Scripts

Visual Studio .NET 2003

The Microsoft Visual Studio .NET debugger provides you with a comprehensive debugging environment for testing and correcting errors in your Web document scripts. You can use the Visual Studio .NET debugger to test scripts written in Microsoft Visual Basic Scripting Edition (VBScript) and Microsoft JScript.

You can use the Visual Studio .NET debugger to debug client-side scripts in an ASP.NET page. Client-side scripts consist of statements that appear on the HTML page. Microsoft Internet Explorer executes the script when the document is loaded or in response to an event (such as a button click).

Setting a Breakpoint in Client-Side Script

If you want to set a breakpoint in client-side script, you cannot just set the breakpoint in the project .aspx file. The .aspx file is a server-side document, and breakpoints set there are not translated to the client-side document. Instead, you can set a client-side breakpoint using either of the following methods.

To set a breakpoint in client-side script

Enabling Script Debugging

Note   Script debugging is disabled in Internet Explorer by default. To debug a client-side script application, you must first enable script debugging in Internet Explorer.

To enable script debugging in Internet Explorer 5.5 or later

  1. From the Tools menu, choose Internet Options.
  2. In the Internet Options dialog box, choose the Advanced tab.
  3. In the Browsing category, clear the Disable script debugging check box.
  4. Click OK.

In addition, to hit breakpoints in client-side script, a cookie called ASPCLIENTDEBUG cookie must be set. If this cookie is not set automatically, you can set it manually using the following procedure.

To manually set ASPCLIENTDEBUG cookie

  1. Create an HTML text file that contains the following code:
    <script language="JavaScript">
    function set ()
        var expdate = new Date(); 
       alert("setting cookie \""+form1.txtName.value+"\" to \""+form1.txtValue.value+"\"");
        setCookie(form1.txtName.value, form1.txtValue.value, expdate); 
    function get ()
       alert("getting cookie \""+form1.txtName.value+"\"");
        var c = getCookie(form1.txtName.value);
        alert( "cookie = "+c );
        form1.txtValue.value = c;
    function getCookie (sCookieName)
        var sName=sCookieName+"=", ichSt, ichEnd;
        var sCookie=document.cookie;
        if ( sCookie.length && ( -1 != (ichSt = sCookie.indexOf(sName)) ) )
            if (-1 == ( ichEnd = sCookie.indexOf(";",ichSt+sName.length) ) )
                ichEnd = sCookie.length;
            return unescape(sCookie.substring(ichSt+sName.length,ichEnd));
        return null;
function setCookie (sName, vValue)
    var argv = setCookie.arguments, argc = setCookie.arguments.length;
    var sExpDate = (argc > 2) ? "; expires="+argv[2].toGMTString() : "";
    var sPath = (argc > 3) ? "; path="+argv[3] : "";
    var sDomain = (argc > 4) ? "; domain="+argv[4] : "";
    var sSecure = (argc > 5) && argv[5] ? "; secure" : "";
    document.cookie = sName + "=" + escape(vValue,0) + sExpDate + sPath + sDomain + sSecure + ";";
function deleteCookie (sName)
    document.cookie = sName + "=" + getCookie(sName) + "; expires=" + (new Date()).toGMTString() + ";";




<form name=form1>
   cookie name:<input type="text" name="txtName" value="ASPCLIENTDEBUG"><p>
   cookie value:<input type="text" name="txtValue" value="doesn't matter"><p>
   <input type="button" value="Set Cookie" onClick="set()">
   <input type="button" value="Get Cookie" onClick="get()">
  1. Save the file as cookie.html.
  2. Copy the file to
  3. In the Internet Explorer Address box, type:
  4. In the http://localhost/cookie.html window, click the Set Cookie button.

Better Error Messages For Script Debugging

Visual Studio .NET 2003 provides enhanced error messages for common script debugging problems. You will normally not see these messages unless you attach to Internet Explorer manually instead of having the debugger launch Internet Explorer automatically. If you encounter a problem, use the following procedure to manually attach and get more information.

To manually attach

  1. From the Debug menu, choose Processes.

    The Processes dialog box appears.

  2. If you have already started debugging, go to the list of Debugged Processes. Select the process you are debugging and click Detach.
  3. In the Available Processes box, find Internet Explorer (iexplore.exe), select it, and click Attach.
  4. In the Attach to Process dialog box, under Choose the program types that you want to debug, select only Script.
  5. Click OK.
  6. At this point, an error message box may appear. If it does, click the Help button to get more information.

See Also

Debugging Client-Side Scripts in a Web Page | Debugging Client-Side Scripts in Your Application | Debugging an ASP.NET Web Applications | Debugging Script and Web Applications
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft