WebAdministrationDsc icon indicating copy to clipboard operation
WebAdministrationDsc copied to clipboard

Adding a Sub Virtual Directory Under a Virtual Directory

Open n8yeung opened this issue 6 years ago • 2 comments

I'm trying to use the xWebAdministration to add a sub virtual directory under a virtual directory and I'm unable to create the sub-virtual directory within the virtual directory. Here's what I've tried so far:

            if($_.Name -match "Images" -and $_.Website -match "Website") {                   
                $AdminImagesVirtualDirectory = xWebVirtualDirectory "$($_.Website)_$($_.Name)_$($_.WebApplication)_Virt".Replace(" ","").Replace("/","_")
                {
                    Name = $_.Name
                    Ensure = $_.Ensure
                    Website = $_.Website
                    PhysicalPath = $PhysicalPath
                    WebApplication = $_.WebApplication
                    DependsOn = $_.DependsOn
                }
            } elseif ($_.Name -match "Common" -and $_.Website -match "Website") {
                xWebVirtualDirectory "$($_.Website)_$($AdminImagesVirtualDirectory.Name)_$($_.Name)_$($_.WebApplication)_Virt".Replace(" ","").Replace("/","_")
                {
                    Name = $_.Name
                    Ensure = $_.Ensure
                    Website = $_.Website
                    PhysicalPath = $PhysicalPath
                    WebApplication = $_.WebApplication
                    DependsOn = $_.DependsOn
                }
            } 

Basically, I am creating the images virtual directory first and then I'm trying to create the Common subdirectory under the images virtual directory. Is this supported?

Is there a way a better way to do this with xWebAdministration?

n8yeung avatar Feb 27 '18 21:02 n8yeung

I was able to create a sub virtual directory by using images/common for the Name

n8yeung avatar Feb 28 '18 19:02 n8yeung

Thanks for reporting this. Glad you found a solution. This should be documented, maybe as an example, and it should be added as an integration test.

johlju avatar Apr 27 '18 14:04 johlju