Moving from developing ASP.NET sites against the full IIS to IIS Express led me to migrating the many virtual directories that were defined for the site. There was an added dimension to the problem, in that the the virtual directories map to central development resources server to keep the many GB of images and tens of thousands of pdf files off the developer SSD drives, for space reasons (and sanity).
To my relief it turns out to be totally possible for website projects (as oppose to website application projects), but I didn’t on performing a quick internet search, find any reference to credentials.
The virtual directories can be set up as part of the site definition in the .vs folder within the applicationhost.config of the website solution. By editing that file, under the following node:
<application path= …
<virtualDirectory path= …
Luckily rather than in notepad, I opened up this file in Visual Studio, and found intellisense gave me the answer I had been looking for, and it was a good one!
You can see there are userName and password attributes available.
So add a virtualDirectory node for each virtual directory, following this pattern, one after another, after the application node.
<virtualDirectory path="/imageitems" physicalPath="\\resServer\Resources\ProdRes"
userName="email@example.com" password="ourpassword123" />
We use a read only, low rights user for this, so I’m not too bothered about the password getting into the config file.