• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 681
  • Last Modified:

Creating virtual directory within a virtual directory...

I'm having trouble finding a way to create a virtual directory within a folder that's inside a virtual directory.
ex:  in IIS I created a Virtual Directory called MySite.  That VD has a bunch of subdirectories within it and in order for my program to work, I need to also activate one of those subdirectories folders as a virtual directory.  I have not found a way to do it through a script, the only way I can do it now is to open IIS manager, right click on the folder and click the 'create' button.  Any help would be much appreiciated.
0
Mesite
Asked:
Mesite
  • 3
1 Solution
 
Praveen DMInfra Team LeadCommented:
These are basic steps to create VD in IIS.. By the way I guess you know these better..R u trying to create VD via script to skip this manual involvement ?

*************
In IIS Manager, expand the local computer and the Web site to which you want to add a virtual directory.

Right-click the site or folder in which you want to create the virtual directory, click New, and then click Virtual Directory.

In the Virtual Directory Creation Wizard, click Next.

In the Alias box, type a name for the virtual directory and then click Next. Choose a short name that is easy to type, because users type this name to access the Web site.

In the Path box, type or browse to the physical directory that contains the virtual directory, and then click Next.

You can select an existing folder or create a new one to contain the content for the virtual directory.

Select the check boxes for the access permissions that you want to assign to the users.

By default, the Read and Run Scripts check boxes are selected. These permissions enable you to run ASP.NET pages for many common scenarios.

Click Next and then click Finish.

MS
***********
0
 
Praveen DMInfra Team LeadCommented:
CoGetObject Example  
InstallShield DevStudio ยป InstallScript Language Reference

 * InstallShield Example Script
 *
 * Demonstrates the CoGetObject function.
 *
 * This example shows how to create a virtual
 * directory on IIS server.
 *
\*--------------------------------------------------------------*/

#include "ifx.h"

#define VIRTUALDIR "My Virtual Dir"
#define VIRTUALDIRPATH "c:\inetpub\wwwroot\MyDir"

function OnBegin()
OBJECT objIIS_Root, objVirtDir;

begin

  set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
  if (IsObject(objIIS_Root)) then
      try
        set objVirtDir = objIIS_Root.Create("IISWebVirtualDir", VIRTUALDIR);
        if (IsObject(objVirtDir)) then
          objVirtDir.Path = VIRTUALDIRPATH;
          objVirtDir.AccessRead = TRUE;
          objVirtDir.AccessScript = TRUE;
          objVirtDir.SetInfo();
          objVirtDir.AppCreate(TRUE);
          objVirtDir.SetInfo();
       endif;
    catch
      MessageBox("Unable to create Virual Directory.", INFORMATION);
    endcatch;
  endif;
 
end;



*************************************

0
 
MesiteAuthor Commented:
Yes, I'm looking for an automated process.  I'm trying to create a VD witin a folder that's within an already established VD.  Here is a snippet of code and the something is the folder within the VD.  The VD that was created is MySite.:

    Set Site = getObject("IIS://localhost/W3svc/1/root/ & MySite & something")
0
 
Praveen DMInfra Team LeadCommented:
***************************

' Create an instance of the virtual directory object  
' that represents the default Web site.
Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root")

' Use the Windows ADSI container object "Create" method to create  
' a new virtual directory.
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir", "NewVDir")

' Use the Windows ADSI object "Put" method to  
' set some required properties.
IIsWebVDirObj.Put "Path", "C:\NewContent"  
IIsWebVDirObj.Put "AccessRead", True
IIsWebVDirObj.Put "AccessScript", True

' Use the AppCreate2 method of the IIS ADSI provider to  
' create an application on the new virtual directory.
IIsWebVDirObj.AppCreate2 1
IIsWebVDirObj.Put "AppFriendlyName", "NewApp"

' Use the Windows ADSI object "SetInfo" method to  
' save the data to the metabase.
IIsWebVDirObj.SetInfo

********************

http://msdn.microsoft.com/en-us/library/ms524830.aspx

I hope this takes you close to the solution...Make sure your ACL ( Permissions part in IIS is also given upto Administrator rights for your user access...Cheers Good luck..
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now