Might not want to enable for entire site, can enable on page basis via @ Page directive:
<%@ Page Debug="true" ... %>
When enabled Visual Studio automatically attaches to ASP.NET web server process (unless developing remotely). Can then set breakpoints, step through code, examine variables, etc.
Likely don't want users to see default ASP.NET error pages, instead want to show page telling them to contact customer support.
Configured via <customErrors>
element in web.config which has two attributes:
On redirection server passed path of page causing error as part of query string
Can define error pages for various HTTP status codes using error
element.
Allows more specific information to be provided to users.
<system.web>
<customErrors defaultRedirect="SiteError.aspx" mode="RemoteOnly">
<error statusCode="403" redirect="RestrictedAccess.aspx" />
</customErrors>
</system.web>
Errors between 400 and 499 represent request errors.
Those between 500 and 599 are for server errors.
Code | Description |
---|---|
400 | Request not understood |
403 | Access denied |
404 | Resource not found |
408 | Timeout |
500 | Internal server error |
503 | Server capacity exceeded |
Normally debug locally on development machine. May be occasions when this is not possible, e.g. problem only manifests itself on remote server.
Enabling Remote Debugging made easier by Visual studio Remote Debugging Monitor (msvsmon.exe).
Run this tool on server to be debugged, typically one instance for each debugger.
Tool first determines if firewall will allow remote debugging - prompts user to open ports if necessary.
Once running the UI displays debugging events.
Can use to set debugging security options on server - via Tools | Options. Each instance of the Debugging Monitor will have a server name. Can restrict access to specific users via Permissions dialogue.
On client open Visual Studio solution containing code to be debugged.
Select Debug | Attach To Process
Set Qualifier to server name defined for Remote Debugging Monitor.
Will then see list of processes running on that server - select appropriate one to attach to.
Can debug client script running in browser.
Need to enable script debugging support in browser - in Internet Explorer select Tools | Internet Options, on the Advanced tab clear Disable Script Debugging.
Set breakpoint in client script via Visual Studio.
Alternatively can manually attach to code running in browser.