Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘System.Diagnostics’

ASP 4.0 – Understanding Page Events | Lab #003

Step 5 - Start Debug and Observe the Output

In ASP.Net, the client browser will make a request to get a web page. After displaying the page, user can do further navigation via the displayed webpage. In the server side, the server will raise multiple events during the life cycle of a web page. Some of the page events are below:

Page Init: This stage Initializes the page with controls. If any theme needs to be applied, it will be applied here in this phase.

Load: This stage loads the web page with all the controls. In case of post-back, web server will set control properites from the view state. We will learn more about view state in some other article.

Validate: Uses Validator Control and runs validation.

Event Handle: Runs the post-back events. Note, in web application the event happens on the clients browser and its event routines will run on the server at later stage. For Example, let us say a browsing user triggers the text_changed event on the browser end. The event handler routine for the text_changed will run on the server when the user submites text field containing Web-Form or if a post-back occurred. We will learn about post back later.

Render: In this stage, rendering the page for the web -browser occurs. It is a dynamic html generation stage.

Unload: This stage denotes the unloading of the page from the Server memory. After this stage the page becomes no more.

Continue Reading →

Spawning A Process in C#

C# Spawn Process Example

The sample application has two parts. The first part starts a notepad process when you click the ‘Start’ (Marked as 1) button. You can enter the text document location in the text box (Marked as 2) before clicking the start button. When a text document is specified, the notepad process opens that document.

In the second part, the example app runs the batch as a process when we click the start button (Marked as 7). The batch file performs a ‘DOS Copy’ operation, which requires Source and Destination locations. We can supply these data can through two text boxes (Marked as 3 & 4). When a batch file execution continues, we can see a console window in the background. The checkbox ‘Make Silent’ (marked as 5) suppresses the background command window. The checkbox ‘Notify when closed’ (Marked as 6) when checked, allows the application receiving the notification when process finished its operation. In our case, when the batch file completes the copy action, our example gets a notification.

Continue Reading →