private void DeployFile(string fileName, UploadContent content, List <string> storageHierarchy, bool useContentPath) { string relativePath = "~/" + string.Join("/", storageHierarchy) + "/" + fileName; string path = useContentPath ? _webHelperService.ContentPath(relativePath) : _webHelperService.MapPath(relativePath); using (FileStream fs = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) { fs.Write(content.Content, 0, content.Content.Length); } }