Skip to content

Commit

Permalink
Update sample5.vb (#956)
Browse files Browse the repository at this point in the history
* Update sample5.vb

Correct VBS code (current is JavaScript).

* Update iis/configuration/moduleProviders/index/samples/sample5.vb

Correcting back `moduleProvidersCollection`

* Apply suggestions from code review

Fixed my error, ensured `modulesSection` is used throughout.

* Rename sample5.vb to sample5.vbs

* Update index.md

Updated link for sample5.vbs

---------

Co-authored-by: Wade Pickett <[email protected]>
  • Loading branch information
6eh01der and wadepickett authored Apr 11, 2024
1 parent 37634e1 commit 1ed1589
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion iis/configuration/moduleProviders/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ The following code examples add a managed module provider named ContosoProvider

### VBScript

[!code-vb[Main](index/samples/sample5.vb)]
[!code-vb[Main](index/samples/sample5.vbs)]
12 changes: 0 additions & 12 deletions iis/configuration/moduleProviders/index/samples/sample5.vb

This file was deleted.

12 changes: 12 additions & 0 deletions iis/configuration/moduleProviders/index/samples/sample5.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT"
adminManager.SetMetadata "pathMapper", "AdministrationConfig"
Set modulesSection = adminManager.GetAdminSection("modules", "MACHINE/WEBROOT")

Set moduleProvidersCollection = modulesSection.Collection
Set addElement = moduleProvidersCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "ContosoProvider"
addElement.Properties.Item("type").Value = "Contoso.Provider, System.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73"
moduleProvidersCollection.AddElement(addElement)

adminManager.CommitChanges()

0 comments on commit 1ed1589

Please sign in to comment.