Click here to Skip to main content
Click here to Skip to main content

Deploy IIS settings along with your Web Project

, 15 Nov 2006
Rate this:
Please Sign up or sign in to vote.
Very simple code to set the authentication method for your IIS virtual directory

Introduction

One of the issues that you need to consider as you plan for how to deploy your ASP.NET applications is how to deploy IIS settings along with your solution. This is a brief example of how to set the Virtual Directory Authentication Settings.

Using the code

Add the following code to the CustomAction class' Install method:

REM *******************************************************
REM Set IIS Virtual Dir Authentication Settings' 

TODO: Search for the server number <---------*
Dim vRoot = GetObject("IIS://LocalHost/W3svc/1/Root/" & _
            Me.Context.Parameters.Item("dir")) 

' Set authentication method for the Virtual Dir

vRoot.AuthBasic = False     ' Unset Basic Authentication
vRoot.Authanonymous = False ' Unset Anonymous Authentication
vRoot.AuthNTLM = True       ' Set Integrated Windows Authentication

' Actually apply it 
vRoot.SetInfo()

Just in case

How to create an installer class:

  1. On the File menu, point to New, and then choose Project.
  2. In the New Project dialog box, select Visual Basic Projects in the Project Type pane, and then choose Class Library in the Templates pane. In the Name box, type IISCustomAction.
  3. Click OK to close the dialog box.
  4. On the Project menu, choose Add New Item.
  5. In the Add New Item dialog box, choose Installer Class. In the Name box, type IISCustomAction.
  6. Click OK to close the dialog box.

How to create a deployment project for your WebProject:

  1. On the File menu, choose Add Project, New Project..
  2. In the Add Project dialog box, select Setup and Deployment Projects in the Project Type pane, and then choose Web Setup Project in the Templates pane. In the Name box, type IIS Virtual Installer.
  3. Click OK to close the dialog box.
  4. In the Properties window, select the ProductName property and type IIS Virtual Installer.
  5. In the File System Editor, select Application Folder. On the Action menu, choose Add, Project Output.
  6. In the Add Project Output Group dialog box, select the primary output for the WebProject project. Click OK to close the dialog box.

How to create a custom action for your Deployment Project:

  1. Right click the IIS Virtual Installer Web Setup project in Solution Explorer. On the View menu, point to Custom Actions.
  2. In the Custom Actions Editor, select the Install node. On the Action menu, choose Add Custom Action.
  3. In the Select item in the project dialog box, double-click the Application Folder.
  4. Select the Primary output from the IISCustomAction(Active) item, then click OK to close the dialog box.
  5. In the Properties window, select the CustomActionData property and type /dir=[TARGETVDIR].
  6. On the Build menu, choose Build DBCustomActionInstaller.

Points of Interest

That's it! It works for me. Of course, this is simple, but maybe I've saved you some time searching for it. Now just think of a bit, to get profit off IIS Admin Objects.

Also check out A C Sharp alternative for Visual Basic GetObject function.

History

  • Nov. 14, 2006 - Initial version.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

rmortega77
Software Developer CIMEX S.A.
Cuba Cuba
Rodolfo Ortega is a Cuban Computer Scientist. He works as IT Auditor for the CIMEX S.A. subsidiary in Holguin, Cuba. He lives and works in Holguin, in the eastern part of the island of Cuba.

You can contact him at rodolfom[]cimex.com.cu for any personal message: Ideas on new articles, bibliography about new APIs, questions, are wellcome.

Submit questions related with current article to the article forum.

Comments and Discussions

 
GeneralDirectory Services PinmemberMember 357722813-Dec-10 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 15 Nov 2006
Article Copyright 2006 by rmortega77
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid