Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


API to enable web sharing programmatically

Posted on 2006-06-07
Medium Priority
Last Modified: 2007-12-19
Is there any API or some way in VB to enable web sharing for a folder programmatically?

Thanks in advance.
Question by:sankarbha
LVL 26

Accepted Solution

EDDYKT earned 2000 total points
ID: 16860516
Set oIIS = GetObject("IIS://localhost/W3SVC/1/root")  '
    Set oVirtualDir = oIIS.Create("IIsWebVirtualDir", "your Virtual directory name")
    oVirtualDir.Path = "your full path"
    oVirtualDir.AccessRead = True
    oVirtualDir.AccessWrite = True
    oVirtualDir.AccessExecute = True
    oVirtualDir.AuthAnonymous = False
    oVirtualDir.AuthBasic = False
    oVirtualDir.AuthNTLM = True
    oVirtualDir.ContentIndexed = True
    oVirtualDir.EnableDirBrowsing = False
    oVirtualDir.AppIsolated = False
    oVirtualDir.AspBufferingOn = True
    oVirtualDir.AspSessionTimeout = 1
    If InStr(1, oVirtualDir.DefaultDoc, "Default.asp") = 0 Then
        oVirtualDir.DefaultDoc = "Default.asp, " & oVirtualDir.DefaultDoc
    End If
    oVirtualDir.EnableDefaultDoc = True
    Call oVirtualDir.AppCreate(True)
    oVirtualDir.AppFriendlyName = "your PackageName"
    Call oVirtualDir.SetInfo
    Set oVirtualDir = Nothing
    Set oIIS = Nothing

Author Comment

ID: 16860833
Great its working. Thanks EDDYKT.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question