-------------------------------------------------------------------- SearchWin2000.com's Developer Tip -------------------------------------------------------------------- TODAY'S DEVELOPER TIP: Controlling IIS programmatically ==================================================================== SPONSORED BY: VeriSign - The Internet Trust Company ==================================================================== Do you need to encrypt all your online transactions? Secure corporate intranets? Authenticate your Web site? Whatever security your site needs, you'll find the perfect solution in this FREE Guide from VeriSign, "Securing Your Web site for Business." Get your copy today to learn the facts! Click here! http://www.verisign.com/cgi-bin/go.cgi?a=n094530150013000 ==================================================================== "Controlling IIS programmatically" By Gerry O'Brien Want to control IIS through programming? This tip, excerpted from InformIT, gives some basic ideas you'll need to do just that. Information relating to the configuration of IIS is stored in the metabase as binary values. To manipulate these values, you use the IIS Admin Objects. There are IIS Admin Objects that correspond to specific key types in the metabase. By using ASP or scripts, you can create your own applications for remotely administering your IIS server. There are two ways to program IIS: You can use the IIS Admin Objects, which is what we will be covering in this chapter, or you can use the IIS Admin Base Object. The IIS Admin Base Object provides you with more advanced programming capabilities. The IIS Admin Base Object is a low-level interface used with COM+-compliant languages such as C++. You use the IMSAdminBase interface to work with the IIS Admin Base Object. Using this interface and the C++ programming language, you can create applications to manipulate the IIS configuration by gaining access to the metabase keys and values. In order to access this functionality, you work with what are known as handles. These handles refer to the keys in the metabase. You need to use the OpenKey method to gain access to a handle for a metabase key. You provide the full metabase path to the key. An example would be /LM/MSFTPSVC/1. This path points to the first FTP server on the local machine. The IIS Admin Base Object has a master handle, called the METADATA_MASTER_ROOT_HANDLE. Although this is the master handle, it does not offer any protection in relation to multiple-thread access of the metabase. This means that you can have a multithreaded application accessing the metabase, and one thread may change a key's value without another thread being aware of this change. This may be an issue if one thread's execution depends on the value stored in another key. If that value is inadvertently changed, it may cause a malfunction in the application. The IIS Base Admin Object makes use of inheritance as well. This means that you can assign a value to a root object or parent object and indicate that each subkey or subobject should inherit these settings. This feature will apply settings across an entire server or site. It can be overridden by specifying a new setting for individual objects. When dealing with the IIS Admin Base Object, you will work with some user types. These user types allow you to assign a classification to your identifiers by application. IIS currently uses four user types: - IIS_MD_UT_FILE -- Is used for directory and file properties - IIS_MD_UT_SERVER -- Configures server parameters - IIS_MD_UT_WAM -- Deals with Web application management - ASP_MD_UT_APP -- Configures ASP applications You can download the Windows 2000 Platform Software Development Kit (SDK) from the Microsoft Web site at http://msdn.microsoft.com/downloads/default.asp?URL=/code/topic.asp?URL=/msdn-files/028/000/123/topic.xml. The bottom of the page breaks the SDK into components so that you can download only what you require. This platform SDK provides a wealth of information on using the IIS Admin Base Object to develop applications for IIS manipulation. To read all of this tip, click the link below to visit InformIT. You have to register there, but it's free. [http://www.informit.com/myinformit/login/index.asp?session_id={967EB158-40E9-4008-B17A-4BD5F8DF24C3}&t={6373D50E-EF0B-4084-B8A7-032653E262E2}&n={211F1130-8B67-45AE-8C82-2804428F41A0}] ==================================================================== SPONSORED BY: ORACLE ==================================================================== Oracle Portal - Zero to Portal @Web Speed Oracle Portal is the fastest way to provide a personalized web view and manage corporate assets. As part of the Oracle Internet Platform, it provides security, reliability, and scalability. GET STARTED at http://ad.doubleclick.net/clk;2890497;5058249;x?http://ad.doubleclick.net/clk;2528590;5576638;w?http://www.oracle.com/go/?&Src=201777&Act=67. ==================================================================== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DID YOU LIKE THIS TIP? ==================================================================== Whether you loved it or hated it, why not let us know? Also, let us know what Windows development issues you want to read more about. Email your comments to mailto:tips@searchwin2000. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ==================================================================== LAST CHANCE TO WIN AN MP3 PLAYER! ==================================================================== This is the final week of our TIP CONTEST! Don't miss out on this final opportunity to win a Sony Vaio 64MB MP3 Player, valued at $300! As an added bonus, the winner will be the first person in our Tip Hall of Fame! Submit your tip now at http://searchwin2000.techtarget.com/tipsIndex/0,289482,sid1_tax5e3,00.html. (Categories include Administrator, Developer, Exchange, Migration and Security.) ==================================================================== If you no longer wish to receive this newsletter simply reply to this message with "REMOVE" in the subject line. Or, visit http://searchWin2000.techtarget.com/register and adjust your subscriptions accordingly. If you choose to unsubscribe using our automated processing, you must send the "REMOVE" request from the email account to which this newsletter was delivered. Please allow 24 hours for your "REMOVE" request to be processed.
