Starting a process from a web page
What we will do in this chapter is to learn how to open, for example, Notepad and then explore directly from a page. For this, go to Default.aspx
, and enter the Design
view. Double-click on the Show
button. This takes us into Default.aspx.cs
.
Delete the Page_Load
block, so that it looks like the screen shown in Figure 5.5.1:
Figure 5.5.1: The initial Default.aspx.cs code for this project
First, below the using System
line, enter the following:
using System.Collections.Generic;
You add this line because we are dealing with dictionaries. Then, add one more line below this:
using System.Diagnostics;
You will see shortly why this line is needed. This is how you can start a process. A process, for example, refers to Notepad.
Now, between the set of curly braces beneath the line beginning with protected void Button1_Click...
, enter the following:
Dictionary<string, string> filePrograms = new Dictionary<string, string>();
Hover your mouse over Dictionary
and...