How can I debug JavaScript scripts in. Net?

Source: Internet
Author: User
Step 1: Select "advanced"-"security"-"Enable integrated Windows Authentication" in Internet Settings of IE (this step is very important !!!)
Step 2: also remove the "Disable script debugging" check in "Internet Settings"
Step 3: Start in debug mode Program
Step 4: Select "debug"> "window"> "Run document" in the vs.net menu"
Step 5: double-click the document to be debugged in the "run document" Window
Step 6: Set the breakpoint at the location where the script is required to start debugging in this document
Step 7: run the program on your own and run it at the breakpoint. The rest is the debugging program. I will not talk about it anymore.
Note: If the problem persists, a cookie named "aspclientdebug" may be missing. How to set this cookie:
1. The creation includes the following: Code HTML text file:
<HTML>
<Head>
<Script language = "JavaScript">
Function set ()
{
VaR expdate = new date ();
Expdate. setmonth (expdate. getmonth () + 6 );
Alert ("setting cookie \" "+form1.txt name. Value +" \ "to \" "+form1.txt value. Value + "\"");
Setcookie(form1.txt name. Value, form1.txtvalue. Value, expdate );
}
Function get ()
{
Alert ("getting cookie \" "+form1.txt name. Value + "\"");
VaR c = getcookie(form1.txt name. 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 () + ";";
}
</SCRIPT>
</Head>
<Body>
<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 ()">
</Form>
</Body>
</Html>
2. Save the file as cookie.html.
3. copy the file
C: \ inetput \ wwwroot
4. in Internet Explorer's address box, type:
Http: // localhost/cookie.html
5. In the http: // localhost/cookie.html window, click "set cookie.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.