Thursday, 20 October 2011

Debugging and Testing Questions Part 5

How do I debug an ASP.NET application that wasn't written with
Visual Studio.NET and that doesn't use code-behind?

Start the DbgClr debugger that comes with the .NET Framework SDK, open
the file containing the code you want to debug, and set your breakpoints.
Start the ASP.NET application. Go back to DbgClr, choose Debug Processes
from the Tools menu, and select aspnet_wp.exe from the list of processes.
(If aspnet_wp.exe doesn't appear in the list,check the "Show system
processes" box.) Click the Attach button to attach to aspnet_wp.exe and
begin debugging.
Be sure to enable debugging in the ASPX file before debugging it with
DbgClr. You can enable tell ASP.NET to build debug executables by placing
<%@ Page Debug="true" %> statement at the top of an ASPX file or a
<COMPILATION debug="true" />statement in a Web.config file.

Can a user browsing my Web site read my Web.config or Global.asax

No. The <HTTPHANDLERS>section of Machine.config, which holds the master
configuration settings for ASP.NET, contains entries that map ASAX files,
CONFIG files, and selected other file types to an HTTP handler named
HttpForbiddenHandler, which fails attempts to retrieve the associated
file. You can modify it by editing Machine.config or including an section in a
local Web.config file.

What's the difference between Page.RegisterClientScriptBlock and

RegisterClientScriptBlock is for returning blocks of client-side script
containing functions. RegisterStartupScript is for returning blocks of clientscript
not packaged in functions-in other words, code that's to execute
when the page is loaded. The latter positions script blocks near the end of
the document so elements on the page that the script interacts are loaded
before the script runs.<%@ Reference Control="MyControl.ascx" %>

No comments:

Post a Comment