App_Data folder in a virtual application or directory

This is a common issue when working with webservices in virtual applications in the IIS. Imagine this folder structure:

Website with virtual application

Website with virtual application

The “Website” is the website with it’s App_Data, and “Virtual Application” is a virtual application running a webservice with it’s own App_Data.

To get the physical path to the website’s App_Data folder you write:


And to get the physical path to the Virtual Application’s App_Data folder you write:


The difference lies within the tilde (~) sign, as this defines the relativeness of the path. Adding a “~” to the path tells .NET that this path is relative to where I am.


About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.
This entry was posted in .net, c#, General .NET and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.