Hiren Tailor
Hiren Tailor

Reputation: 408

How to get path 'C:\inetpub\wwwroot\wss\VirtualDirectories' at run-time in installer class (c#)

I have created below code but its not give actual result which i want. Code:-

 ServerManager manager = new ServerManager();
 Site defaultSite = manager.Sites["Default Web Site"];
 string path = manager.Sites[0].Applications["/"].VirtualDirectories["/"].PhysicalPath;

Output:-

The above code give result like '%SystemDrive%\inetpub\wwwroot' instade of this i want actual path like 'C:\inetpub\wwwroot\wss\VirtualDirectories'.

Please help me as soon as possible.

Thanks in Advance.

Upvotes: 3

Views: 770

Answers (1)

alsafoo
alsafoo

Reputation: 788

path = Environment.ExpandEnvironmentVariables(path);

Upvotes: 3

Related Questions