How to emit client-side javascript blocks from VB.NET/C#

The RegisterStartupScript method emits the script just before the closing tag of the Page object’s <form runat= server> element. VB.NET RegisterStartupScript(‘Sample’, ‘<SCRIPT Language=’javascript’>alert(’Hello World’);</SCRIPT>’) C# RegisterStartupScript(‘Sample’, ‘<SCRIPT Language=’javascript’>alert(’Hello World’);</SCRIPT>’); Alternatively, use the RegisterClientScriptBlock method which emits the client-side script just after the opening tag of the Page object’s <form runat= server> element.

How can I see the Trace messages?

For Page Level Tracing specify the Page Directive as <%@ Page Trace=’true’ %> You can view the page on which trace is enabled to true to see the details. For Application Level Tracing modify web.config as <configuration> <system.web> <trace enabled=’true’ requestLimit=’10’ pageOutput=’false’ traceMode=’SortByTime’ localOnly=’true’ /> </system.web> </configuration> You can view the Trace at http://<server>/<webApplicationName>/trace.axd

How to redirect the user to the friendly error-handler page when an Application error occurs

Modify web.config as <customErrors mode=’On’ defaultRedirect=’errorpage.aspx’ /> The <customErrors> configuration section supports an inner <error> tag that associates HTTP status codes with custom error pages. For example: <customErrors mode=’On’ defaultRedirect=’genericerror.htm’> <error statusCode=’404′ redirect=’pagenotfound.aspx’/> <error statusCode=’403′ redirect=’noaccess.aspx’/> </customErrors> For more details refer <customErrors> Element