Configuring Applications LISTING Import Namespace=”” % Import Namespace=”” % Import Namespace=”” % const string wwwroot = @”c:\Inetpub”; const string sitePath = @”IIS://localhost/W3SVC/1/ROOT”; protected void btnSubmit_Click(object sender, EventArgs e) { string newFolder = (wwwroot, ); CreateVirtualDirectory(newFolder, , ); CreateConfiguration(); // Show link to new site = “http://localhost/” + ; = “_top”; = true; } private void CreateVirtualDirectory(string folderPath, string. | 1544 CHAPTER 34 Configuring Applications LISTING @ Page Language C @ Import Namespace @ Import Namespace @ Import Namespace DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD script runat server const string wwwroot @ c Inetpub const string sitePath @ IIS localhost W3SVC 1 ROOT protected void btnSubmit_Click object sender EventArgs e string newFolder wwwroot CreateVirtualDirectory newFolder CreateConfiguration Show link to new site http localhost _top true private void CreateVirtualDirectory string folderPath string virtualDirectory-Name string appFriendlyName Create new Folder folderPath Create Virtual Directory DirectoryEntry vRoot new DirectoryEntry sitePath DirectoryEntry vDir virtualDirectoryName IIsWebVirtualDir Path .Value folderPath DefaultDoc .Value DirBrowseFlags .Value 2147483648 Create Application Isolated AppCreate2 1 From the Library of Wow eBook Using the Configuration API 1545 AppFriendlyName .Value appFriendlyName private void CreateConfiguration string virtualPath Open configuration Configuration config virtualPath Set language and debug setting Compilationsection section CompilationSection compilation Save configuration script html xmlns http 1999 xhtml head id Head1 runat server title Provision Site title head body form id