Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/ILoginViewModelService.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/ILoginViewModelService.cs	(revision 13735)
+++ 	(revision )
@@ -1,14 +1,0 @@
-﻿using HeuristicLab.Clients.Hive.WebJobManager.ViewModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace HeuristicLab.Clients.Hive.WebJobManager.Services
-{
-    public interface ILoginViewModelService
-    {
-        LoginViewModel GetLoginViewModel();
-
-    }
-}
Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/ConcurrentTaskDownloaderWeb.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/ConcurrentTaskDownloaderWeb.cs	(revision 13735)
+++ branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/ConcurrentTaskDownloaderWeb.cs	(revision 13739)
@@ -30,95 +30,114 @@
 
     //
-  /// <summary>
-  /// Rewritten to use HiveServiceLocatorWeb and HiveClientWeb
-  /// </summary>
-  public class ConcurrentTaskDownloaderWeb<T> : IDisposable where T : class, ITask {
-    private bool abort = false;
-    // use semaphore to ensure only few concurrenct connections and few SerializedJob objects in memory
-    private Semaphore downloadSemaphore;
-    private Semaphore deserializeSemaphore;
+    /// <summary>
+    /// Rewritten to use HiveServiceLocatorWeb and HiveClientWeb
+    /// </summary>
+    public class ConcurrentTaskDownloaderWeb<T> : IDisposable where T : class, ITask
+    {
+        private bool abort = false;
+        // use semaphore to ensure only few concurrenct connections and few SerializedJob objects in memory
+        private Semaphore downloadSemaphore;
+        private Semaphore deserializeSemaphore;
+        private HiveServiceLocatorWeb serviceLocator;
+        public ConcurrentTaskDownloaderWeb(int concurrentDownloads, int concurrentDeserializations, HiveServiceLocatorWeb hiv)
+        {
+            downloadSemaphore = new Semaphore(concurrentDownloads, concurrentDownloads);
+            deserializeSemaphore = new Semaphore(concurrentDeserializations, concurrentDeserializations);
+            serviceLocator = hiv;
+        }
 
-    public ConcurrentTaskDownloaderWeb(int concurrentDownloads, int concurrentDeserializations) {
-      downloadSemaphore = new Semaphore(concurrentDownloads, concurrentDownloads);
-      deserializeSemaphore = new Semaphore(concurrentDeserializations, concurrentDeserializations);
+        public void DownloadTaskData(Task t, Action<Task, T> onFinishedAction)
+        {
+            Task<Tuple<Task, T>> task = Task<Tuple<Task, TaskData>>.Factory.StartNew(DownloadTaskData, t)
+                                           .ContinueWith((y) => DeserializeTask(y.Result));
+
+            task.ContinueWith((x) => OnTaskFinished(x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);
+            task.ContinueWith((x) => OnTaskFailed(x), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted);
+        }
+
+        public void DownloadTaskDataAndTask(Guid taskId, Action<Task, T> onFinishedAction)
+        {
+            Task<Tuple<Task, T>> task = Task<Task>.Factory.StartNew(DownloadTask, taskId)
+                                           .ContinueWith((x) => DownloadTaskData(x.Result))
+                                           .ContinueWith((y) => DeserializeTask(y.Result));
+
+            task.ContinueWith((x) => OnTaskFinished(x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);
+            task.ContinueWith((x) => OnTaskFailed(x), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted);
+        }
+
+        private void OnTaskFinished(Task<Tuple<Task, T>> task, Action<Task, T> onFinishedAction)
+        {
+            onFinishedAction(task.Result.Item1, task.Result.Item2);
+        }
+        private void OnTaskFailed(Task<Tuple<Task, T>> task)
+        {
+            task.Exception.Flatten().Handle((e) => { return true; });
+            OnExceptionOccured(task.Exception.Flatten());
+        }
+
+        private Task DownloadTask(object taskId)
+        {
+            Task t = null;
+            HiveClientWeb.TryAndRepeat(() =>
+            {
+                t = serviceLocator.CallHiveService(s => s.GetTask((Guid)taskId));
+            }, Settings.Default.MaxRepeatServiceCalls, "Failed to download task.");
+            return t;
+        }
+
+        protected Tuple<Task, TaskData> DownloadTaskData(object taskId)
+        {
+            return DownloadTaskData((Task)taskId);
+        }
+
+        protected Tuple<Task, TaskData> DownloadTaskData(Task task)
+        {
+            downloadSemaphore.WaitOne();
+            TaskData result = null;
+            try
+            {
+                if (abort) return null;
+                HiveClientWeb.TryAndRepeat(() =>
+                {
+                    result = serviceLocator.CallHiveService(s => s.GetTaskData(task.Id));
+                }, Settings.Default.MaxRepeatServiceCalls, "Failed to download task data.");
+            }
+            finally
+            {
+                downloadSemaphore.Release();
+            }
+            return new Tuple<Task, TaskData>(task, result);
+        }
+
+        protected Tuple<Task, T> DeserializeTask(Tuple<Task, TaskData> taskData)
+        {
+            deserializeSemaphore.WaitOne();
+            try
+            {
+                if (abort || taskData.Item2 == null || taskData.Item1 == null) return null;
+                var deserializedJob = PersistenceUtil.Deserialize<T>(taskData.Item2.Data);
+                taskData.Item2.Data = null; // reduce memory consumption.
+                return new Tuple<Task, T>(taskData.Item1, deserializedJob);
+            }
+            finally
+            {
+                deserializeSemaphore.Release();
+            }
+        }
+
+        public event EventHandler<EventArgs<Exception>> ExceptionOccured;
+        private void OnExceptionOccured(Exception exception)
+        {
+            var handler = ExceptionOccured;
+            if (handler != null) handler(this, new EventArgs<Exception>(exception));
+        }
+
+        #region IDisposable Members
+        public void Dispose()
+        {
+            deserializeSemaphore.Dispose();
+            downloadSemaphore.Dispose();
+        }
+        #endregion
     }
-
-    public void DownloadTaskData(Task t, Action<Task, T> onFinishedAction) {
-      Task<Tuple<Task, T>> task = Task<Tuple<Task, TaskData>>.Factory.StartNew(DownloadTaskData, t)
-                                     .ContinueWith((y) => DeserializeTask(y.Result));
-
-      task.ContinueWith((x) => OnTaskFinished(x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);
-      task.ContinueWith((x) => OnTaskFailed(x), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted);
-    }
-
-    public void DownloadTaskDataAndTask(Guid taskId, Action<Task, T> onFinishedAction) {
-      Task<Tuple<Task, T>> task = Task<Task>.Factory.StartNew(DownloadTask, taskId)
-                                     .ContinueWith((x) => DownloadTaskData(x.Result))
-                                     .ContinueWith((y) => DeserializeTask(y.Result));
-
-      task.ContinueWith((x) => OnTaskFinished(x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);
-      task.ContinueWith((x) => OnTaskFailed(x), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted);
-    }
-
-    private void OnTaskFinished(Task<Tuple<Task, T>> task, Action<Task, T> onFinishedAction) {
-      onFinishedAction(task.Result.Item1, task.Result.Item2);
-    }
-    private void OnTaskFailed(Task<Tuple<Task, T>> task) {
-      task.Exception.Flatten().Handle((e) => { return true; });
-      OnExceptionOccured(task.Exception.Flatten());
-    }
-
-    private Task DownloadTask(object taskId) {
-      Task t = null;
-      HiveClientWeb.TryAndRepeat(() => {
-        t = HiveServiceLocatorWeb.Instance.CallHiveService(s => s.GetTask((Guid)taskId));
-      }, Settings.Default.MaxRepeatServiceCalls, "Failed to download task.");
-      return t;
-    }
-
-    protected Tuple<Task, TaskData> DownloadTaskData(object taskId) {
-      return DownloadTaskData((Task)taskId);
-    }
-
-    protected Tuple<Task, TaskData> DownloadTaskData(Task task) {
-      downloadSemaphore.WaitOne();
-      TaskData result = null;
-      try {
-        if (abort) return null;
-        HiveClientWeb.TryAndRepeat(() => {
-          result = HiveServiceLocatorWeb.Instance.CallHiveService(s => s.GetTaskData(task.Id));
-        }, Settings.Default.MaxRepeatServiceCalls, "Failed to download task data.");
-      }
-      finally {
-        downloadSemaphore.Release();
-      }
-      return new Tuple<Task, TaskData>(task, result);
-    }
-
-    protected Tuple<Task, T> DeserializeTask(Tuple<Task, TaskData> taskData) {
-      deserializeSemaphore.WaitOne();
-      try {
-        if (abort || taskData.Item2 == null || taskData.Item1 == null) return null;
-        var deserializedJob = PersistenceUtil.Deserialize<T>(taskData.Item2.Data);
-        taskData.Item2.Data = null; // reduce memory consumption.
-        return new Tuple<Task, T>(taskData.Item1, deserializedJob);
-      }
-      finally {
-        deserializeSemaphore.Release();
-      }
-    }
-
-    public event EventHandler<EventArgs<Exception>> ExceptionOccured;
-    private void OnExceptionOccured(Exception exception) {
-      var handler = ExceptionOccured;
-      if (handler != null) handler(this, new EventArgs<Exception>(exception));
-    }
-
-    #region IDisposable Members
-    public void Dispose() {
-      deserializeSemaphore.Dispose();
-      downloadSemaphore.Dispose();
-    }
-    #endregion
-  }
 }
Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/HiveClientWeb.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/HiveClientWeb.cs	(revision 13735)
+++ branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/HiveClientWeb.cs	(revision 13739)
@@ -46,14 +46,6 @@
     public sealed class HiveClientWeb : IContent
     {
-        private static HiveClientWeb instance;
-        public static HiveClientWeb Instance
-        {
-            get
-            {
-                if (instance == null) instance = new HiveClientWeb();
-                return instance;
-            }
-        }
-        public static IHostingEnvironment CurrentEnv { get; set; } //Current building area
+       
+        public IHostingEnvironment CurrentEnv { get; set; } //Current building area
         #region Properties
         private HiveItemCollection<RefreshableJob> jobs;
@@ -86,7 +78,19 @@
         #endregion
 
-        private HiveClientWeb()
-        {
-        }
+        private HiveServiceLocatorWeb serviceLocator;
+        public  Guid UserId { get; set; }
+        public HiveClientWeb(HiveServiceLocatorWeb serv, Guid u)
+        {
+            serviceLocator = serv;
+            UserId = u;
+        }
+        /// <summary>
+        /// Reaches to the webloginservice to get the current instance of the servicelocator. 
+        /// </summary>
+        public void updateServiceLocator()
+        {// No idea if needed
+            serviceLocator = WebLoginService.Instance.getServiceLocator(UserId);
+        }
+
 
         public void ClearHiveClientWeb()
@@ -117,5 +121,5 @@
             {
                 jobs = new HiveItemCollection<RefreshableJob>();
-                var jobsLoaded = HiveServiceLocatorWeb.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
+                var jobsLoaded = serviceLocator.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
 
                 foreach (var j in jobsLoaded)
@@ -158,5 +162,5 @@
 
         #region Store
-        public static void Store(IHiveItem item, CancellationToken cancellationToken)
+        public void Store(IHiveItem item, CancellationToken cancellationToken)
         {
             if (item.Id == Guid.Empty)
@@ -164,23 +168,23 @@
                 if (item is RefreshableJob)
                 {
-                    HiveClientWeb.Instance.UploadJob((RefreshableJob)item, cancellationToken);
+                    this.UploadJob((RefreshableJob)item, cancellationToken);
                 }
                 if (item is JobPermission)
                 {
                     var hep = (JobPermission)item;
-                    hep.GrantedUserId = HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName));
+                    hep.GrantedUserId = serviceLocator.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName));
                     if (hep.GrantedUserId == Guid.Empty)
                     {
                         throw new ArgumentException(string.Format("The user {0} was not found.", hep.GrantedUserName));
                     }
-                    HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission));
+                    serviceLocator.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission));
                 }
             }
             else {
                 if (item is Job)
-                    HiveServiceLocatorWeb.Instance.CallHiveService(s => s.UpdateJob((Job)item));
-            }
-        }
-        public static void StoreAsync(Action<Exception> exceptionCallback, IHiveItem item, CancellationToken cancellationToken)
+                    serviceLocator.CallHiveService(s => s.UpdateJob((Job)item));
+            }
+        }
+        public void StoreAsync(Action<Exception> exceptionCallback, IHiveItem item, CancellationToken cancellationToken)
         {
             var call = new Func<Exception>(delegate ()
@@ -205,5 +209,5 @@
 
         #region Delete
-        public static void Delete(IHiveItem item)
+        public void Delete(IHiveItem item)
         {
             if (item.Id == Guid.Empty && item.GetType() != typeof(JobPermission))
@@ -211,5 +215,5 @@
 
             if (item is Job)
-                HiveServiceLocatorWeb.Instance.CallHiveService(s => s.DeleteJob(item.Id));
+                serviceLocator.CallHiveService(s => s.DeleteJob(item.Id));
             if (item is RefreshableJob)
             {
@@ -219,10 +223,10 @@
                     job.StopResultPolling();
                 }
-                HiveServiceLocatorWeb.Instance.CallHiveService(s => s.DeleteJob(item.Id));
+                serviceLocator.CallHiveService(s => s.DeleteJob(item.Id));
             }
             if (item is JobPermission)
             {
                 var hep = (JobPermission)item;
-                HiveServiceLocatorWeb.Instance.CallHiveService(s => s.RevokePermission(hep.JobId, hep.GrantedUserId));
+                serviceLocator.CallHiveService(s => s.RevokePermission(hep.JobId, hep.GrantedUserId));
             }
             item.Id = Guid.Empty;
@@ -251,7 +255,7 @@
         #endregion
 
-        public static void StartJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken)
-        {
-            HiveClientWeb.StoreAsync(
+        public void StartJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken)
+        {
+            this.StoreAsync(
               new Action<Exception>((Exception ex) =>
               {
@@ -262,7 +266,7 @@
         }
 
-        public static void PauseJob(RefreshableJob refreshableJob)
-        {
-            HiveServiceLocatorWeb.Instance.CallHiveService(service =>
+        public void PauseJob(RefreshableJob refreshableJob)
+        {
+            serviceLocator.CallHiveService(service =>
             {
                 foreach (HiveTask task in refreshableJob.GetAllHiveTasks())
@@ -274,7 +278,7 @@
         }
 
-        public static void StopJob(RefreshableJob refreshableJob)
-        {
-            HiveServiceLocatorWeb.Instance.CallHiveService(service =>
+        public void StopJob(RefreshableJob refreshableJob)
+        {
+            serviceLocator.CallHiveService(service =>
             {
                 foreach (HiveTask task in refreshableJob.GetAllHiveTasks())
@@ -286,7 +290,7 @@
         }
 
-        public static void ResumeJob(RefreshableJob refreshableJob)
-        {
-            HiveServiceLocatorWeb.Instance.CallHiveService(service =>
+        public  void ResumeJob(RefreshableJob refreshableJob)
+        {
+            serviceLocator.CallHiveService(service =>
             {
                 foreach (HiveTask task in refreshableJob.GetAllHiveTasks())
@@ -315,5 +319,5 @@
                 foreach (var resourceName in resourceNames)
                 {
-                    Guid resourceId = HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.GetResourceId(resourceName));
+                    Guid resourceId = serviceLocator.CallHiveService((s) => s.GetResourceId(resourceName));
                     if (resourceId == Guid.Empty)
                     {
@@ -330,6 +334,6 @@
                 // upload Job
                 refreshableJob.Progress.Status = "Uploading Job...";
-                refreshableJob.Job.Id = HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job));
-                refreshableJob.Job = HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions
+                refreshableJob.Job.Id = serviceLocator.CallHiveService((s) => s.AddJob(refreshableJob.Job));
+                refreshableJob.Job = serviceLocator.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions
                 cancellationToken.ThrowIfCancellationRequested();
 
@@ -340,7 +344,7 @@
                 // upload plugins
                 refreshableJob.Progress.Status = "Uploading plugins...";
-                this.OnlinePlugins = HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.GetPlugins());
+                this.OnlinePlugins = serviceLocator.CallHiveService((s) => s.GetPlugins());
                 this.AlreadyUploadedPlugins = new List<Plugin>();
-                Plugin configFilePlugin = HiveServiceLocatorWeb.Instance.CallHiveService((s) => UploadConfigurationFile(s, onlinePlugins));
+                Plugin configFilePlugin = serviceLocator.CallHiveService((s) => UploadConfigurationFile(s, onlinePlugins));
                 this.alreadyUploadedPlugins.Add(configFilePlugin);
                 cancellationToken.ThrowIfCancellationRequested();
@@ -371,5 +375,5 @@
         /// Uploads the local configuration file as plugin
         /// </summary>
-        private static Plugin UploadConfigurationFile(IHiveService service, List<Plugin> onlinePlugins)
+        private Plugin UploadConfigurationFile(IHiveService service, List<Plugin> onlinePlugins)
         {
             string exeFilePath = Path.Combine( CurrentEnv.WebRootPath, "bin"  , HeuristicLab.Clients.Hive.Settings.Default.HLBinaryName);
@@ -436,5 +440,5 @@
                         lock (pluginLocker)
                         {
-                            HiveServiceLocatorWeb.Instance.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));
+                            serviceLocator.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));
                         }
                     }
@@ -451,8 +455,8 @@
                         if (parentHiveTask != null)
                         {
-                            hiveTask.Task.Id = HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData));
+                            hiveTask.Task.Id = serviceLocator.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData));
                         }
                         else {
-                            hiveTask.Task.Id = HiveServiceLocatorWeb.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList()));
+                            hiveTask.Task.Id = serviceLocator.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList()));
                         }
                     }
@@ -488,5 +492,5 @@
 
         #region Download Experiment
-        public static void LoadJob(RefreshableJob refreshableJob)
+        public void LoadJob(RefreshableJob refreshableJob)
         {
             var hiveExperiment = refreshableJob.Job;
@@ -501,9 +505,9 @@
                 // fetch all task objects to create the full tree of tree of HiveTask objects
                 refreshableJob.Progress.Start("Downloading list of tasks...");
-                allTasks = HiveServiceLocatorWeb.Instance.CallHiveService(s => s.GetLightweightJobTasksWithoutStateLog(hiveExperiment.Id));
+                allTasks = serviceLocator.CallHiveService(s => s.GetLightweightJobTasksWithoutStateLog(hiveExperiment.Id));
                 totalJobCount = allTasks.Count();
 
                 refreshableJob.Progress.Status = "Downloading tasks...";
-                downloader = new TaskDownloaderWeb(allTasks.Select(x => x.Id));
+                downloader = new TaskDownloaderWeb(allTasks.Select(x => x.Id), serviceLocator);
                 downloader.StartAsync();
 
@@ -572,7 +576,7 @@
         }
 
-        public static ItemTask LoadItemJob(Guid jobId)
-        {
-            TaskData taskData = HiveServiceLocatorWeb.Instance.CallHiveService(s => s.GetTaskData(jobId));
+        public ItemTask LoadItemJob(Guid jobId)
+        {
+            TaskData taskData = serviceLocator.CallHiveService(s => s.GetTaskData(jobId));
             try
             {
@@ -603,7 +607,7 @@
         }
 
-        public static HiveItemCollection<JobPermission> GetJobPermissions(Guid jobId)
-        {
-            return HiveServiceLocatorWeb.Instance.CallHiveService((service) =>
+        public  HiveItemCollection<JobPermission> GetJobPermissions(Guid jobId)
+        {
+            return serviceLocator.CallHiveService((service) =>
             {
                 IEnumerable<JobPermission> jps = service.GetJobPermissions(jobId);
Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/HiveServiceLocatorWeb.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/HiveServiceLocatorWeb.cs	(revision 13735)
+++ branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/HiveServiceLocatorWeb.cs	(revision 13739)
@@ -2,4 +2,5 @@
 using HeuristicLab.Clients.Common.Properties;
 using HeuristicLab.Clients.Hive.WebJobManager.ViewModels;
+using Microsoft.AspNet.Http;
 using Microsoft.AspNet.Mvc;
 using System;
@@ -17,17 +18,6 @@
     public class HiveServiceLocatorWeb : IHiveServiceLocator
     {
-        private static IHiveServiceLocator instance = null;
         private HiveServiceClient clientinst;
-        public static IHiveServiceLocator Instance
-        {
-            get
-            {
-                if (instance == null)
-                {
-                    instance = new HiveServiceLocatorWeb();
-                }
-                return instance;
-            }
-        }
+        public Guid UserId {get; set; }
         private string username;
         public string Username
@@ -47,8 +37,4 @@
         public string WorkingEndpoint { get; private set; }
 
-        public static void clear()
-        {
-            instance = null;
-        }
 
         #region #unknownCalls
@@ -132,8 +118,4 @@
             return false;
         }
-        public static void SetLoginErrorMessage()
-        {
-             LoginViewModelService.Instance.GetLoginViewModel().errorMessage = "Login timed out";
-        }
 
         public string GetEndpointInformation()
@@ -195,8 +177,7 @@
         }
 
-        public void destroy()
+        public void destroyClient()
         {
             clientinst = null;
-            instance = null;
         }
     }
Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/TaskDownloaderWeb.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/TaskDownloaderWeb.cs	(revision 13735)
+++ branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Imports/TaskDownloaderWeb.cs	(revision 13739)
@@ -26,102 +26,132 @@
 using HeuristicLab.Common;
 
-namespace HeuristicLab.Clients.Hive.WebJobManager.Services.Imports {
+namespace HeuristicLab.Clients.Hive.WebJobManager.Services.Imports
+{
 
     /// <summary>
     /// Rewritten to use HiveClientWeb and HiveServiceLocatorWeb
     /// </summary>
-  public class TaskDownloaderWeb : IDisposable {
-    private IEnumerable<Guid> taskIds;
-    private ConcurrentTaskDownloaderWeb<ItemTask> taskDownloader;
-    private IDictionary<Guid, HiveTask> results;
-    private bool exceptionOccured = false;
-    private Exception currentException;
-    private ReaderWriterLockSlim resultsLock = new ReaderWriterLockSlim();
+    public class TaskDownloaderWeb : IDisposable
+    {
+        private HiveServiceLocatorWeb serviceLocator;
+        private IEnumerable<Guid> taskIds;
+        private ConcurrentTaskDownloaderWeb<ItemTask> taskDownloader;
+        private IDictionary<Guid, HiveTask> results;
+        private bool exceptionOccured = false;
+        private Exception currentException;
+        private ReaderWriterLockSlim resultsLock = new ReaderWriterLockSlim();
 
-    public bool IsFinished {
-      get {
-        try {
-          resultsLock.EnterReadLock();
-          return results.Count == taskIds.Count();
+        public bool IsFinished
+        {
+            get
+            {
+                try
+                {
+                    resultsLock.EnterReadLock();
+                    return results.Count == taskIds.Count();
+                }
+                finally { resultsLock.ExitReadLock(); }
+            }
         }
-        finally { resultsLock.ExitReadLock(); }
-      }
+
+        public bool IsFaulted
+        {
+            get
+            {
+                return exceptionOccured;
+            }
+        }
+
+        public Exception Exception
+        {
+            get
+            {
+                return currentException;
+            }
+        }
+
+        public int FinishedCount
+        {
+            get
+            {
+                try
+                {
+                    resultsLock.EnterReadLock();
+                    return results.Count;
+                }
+                finally { resultsLock.ExitReadLock(); }
+            }
+        }
+
+        public IDictionary<Guid, HiveTask> Results
+        {
+            get
+            {
+                try
+                {
+                    resultsLock.EnterReadLock();
+                    return results;
+                }
+                finally { resultsLock.ExitReadLock(); }
+            }
+        }
+
+        public TaskDownloaderWeb(IEnumerable<Guid> jobIds, HiveServiceLocatorWeb hiv)
+        {
+            taskIds = jobIds;
+            serviceLocator = hiv;
+            taskDownloader = new ConcurrentTaskDownloaderWeb<ItemTask>(
+                Settings.Default.MaxParallelDownloads,
+                Settings.Default.MaxParallelDownloads,
+                serviceLocator);
+            taskDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(taskDownloader_ExceptionOccured);
+            results = new Dictionary<Guid, HiveTask>();
+            
+        }
+
+        public void StartAsync()
+        {
+            foreach (Guid taskId in taskIds)
+            {
+                taskDownloader.DownloadTaskDataAndTask(taskId,
+                  (localTask, itemTask) =>
+                  {
+                      if (localTask != null && itemTask != null)
+                      {
+                          HiveTask hiveTask = itemTask.CreateHiveTask();
+                          hiveTask.Task = localTask;
+                          try
+                          {
+                              resultsLock.EnterWriteLock();
+                              results.Add(localTask.Id, hiveTask);
+                          }
+                          finally { resultsLock.ExitWriteLock(); }
+                      }
+                  });
+            }
+        }
+
+        private void taskDownloader_ExceptionOccured(object sender, EventArgs<Exception> e)
+        {
+            OnExceptionOccured(e.Value);
+        }
+
+        public event EventHandler<EventArgs<Exception>> ExceptionOccured;
+        private void OnExceptionOccured(Exception exception)
+        {
+            exceptionOccured = true;
+            currentException = exception;
+            var handler = ExceptionOccured;
+            if (handler != null) handler(this, new EventArgs<Exception>(exception));
+        }
+
+        #region IDisposable Members
+        public void Dispose()
+        {
+            taskDownloader.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(taskDownloader_ExceptionOccured);
+            resultsLock.Dispose();
+            taskDownloader.Dispose();
+        }
+        #endregion
     }
-
-    public bool IsFaulted {
-      get {
-        return exceptionOccured;
-      }
-    }
-
-    public Exception Exception {
-      get {
-        return currentException;
-      }
-    }
-
-    public int FinishedCount {
-      get {
-        try {
-          resultsLock.EnterReadLock();
-          return results.Count;
-        }
-        finally { resultsLock.ExitReadLock(); }
-      }
-    }
-
-    public IDictionary<Guid, HiveTask> Results {
-      get {
-        try {
-          resultsLock.EnterReadLock();
-          return results;
-        }
-        finally { resultsLock.ExitReadLock(); }
-      }
-    }
-
-    public TaskDownloaderWeb(IEnumerable<Guid> jobIds) {
-      taskIds = jobIds;
-      taskDownloader = new ConcurrentTaskDownloaderWeb<ItemTask>(Settings.Default.MaxParallelDownloads, Settings.Default.MaxParallelDownloads);
-      taskDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(taskDownloader_ExceptionOccured);
-      results = new Dictionary<Guid, HiveTask>();
-    }
-
-    public void StartAsync() {
-      foreach (Guid taskId in taskIds) {
-        taskDownloader.DownloadTaskDataAndTask(taskId,
-          (localTask, itemTask) => {
-            if (localTask != null && itemTask != null) {
-              HiveTask hiveTask = itemTask.CreateHiveTask();
-              hiveTask.Task = localTask;
-              try {
-                resultsLock.EnterWriteLock();
-                results.Add(localTask.Id, hiveTask);
-              }
-              finally { resultsLock.ExitWriteLock(); }
-            }
-          });
-      }
-    }
-
-    private void taskDownloader_ExceptionOccured(object sender, EventArgs<Exception> e) {
-      OnExceptionOccured(e.Value);
-    }
-
-    public event EventHandler<EventArgs<Exception>> ExceptionOccured;
-    private void OnExceptionOccured(Exception exception) {
-      exceptionOccured = true;
-      currentException = exception;
-      var handler = ExceptionOccured;
-      if (handler != null) handler(this, new EventArgs<Exception>(exception));
-    }
-
-    #region IDisposable Members
-    public void Dispose() {
-      taskDownloader.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(taskDownloader_ExceptionOccured);
-      resultsLock.Dispose();
-      taskDownloader.Dispose();
-    }
-    #endregion
-  }
 }
Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Jobs/FileOpeningService.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Jobs/FileOpeningService.cs	(revision 13735)
+++ branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Jobs/FileOpeningService.cs	(revision 13739)
@@ -16,4 +16,7 @@
     public class FileOpeningService
     {
+        public Guid UserId { get; set; }
+
+        private WebLoginService weblog;
         public RefreshableJob Job { get; set; }
         public FileOpeningViewModel vm { get; set; }
@@ -22,16 +25,13 @@
             get; set; }
         public List<int> previousLogs { get; set; }
-        private static FileOpeningService instance;
-        public static FileOpeningService Instance
+        
+
+        public FileOpeningService(Guid u)
         {
-            get
-            {
-                if (instance == null)
-                {
-                    instance = new FileOpeningService();
-                }
-                return instance;
-            }
+            weblog = WebLoginService.Instance;
+            UserId = u;
         }
+
+
         /// <summary>
         /// Clears loaded jobs and start new one
@@ -58,5 +58,5 @@
         {
            // HiveClientWeb.Instance.Refresh();
-            HiveClientWeb.LoadJob(Job);
+            weblog.getClientWeb(UserId).LoadJob(Job);
         }
         /// <summary>
@@ -68,14 +68,8 @@
             if (vm != null)
             {
-
-
-
-                HiveServiceLocatorWeb serv = (HiveServiceLocatorWeb)HiveServiceLocatorWeb.Instance;
-                //job.Job.Id = serv.getHiveServiceClient().AddJob(job.Job);
-                //  job.Job =  serv.getHiveServiceClient().GetJob(job.Job.Id);
-
-                HiveClientWeb.CurrentEnv = env;
-                HiveClientWeb.Instance.Refresh();
-                HiveClientWeb.StartJob((ex) => { throw ex; }, Job, CancellationToken.None);
+                var clientWeb = weblog.getClientWeb(UserId);
+                clientWeb.CurrentEnv = env;
+                clientWeb.Refresh();
+                clientWeb.StartJob((ex) => { throw ex; }, Job, CancellationToken.None);
                 return Job;
             }
Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/LoginViewModelService.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/LoginViewModelService.cs	(revision 13735)
+++ 	(revision )
@@ -1,41 +1,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using HeuristicLab.Clients.Hive.WebJobManager.ViewModels;
-
-namespace HeuristicLab.Clients.Hive.WebJobManager.Services
-{
-    public class LoginViewModelService : ILoginViewModelService
-    {
-        private static LoginViewModelService instance = null;
-        private static LoginViewModel vm = null;
-        public static ILoginViewModelService Instance
-        {
-            get
-            {
-                if (instance == null)
-                {
-                    instance = new LoginViewModelService();
-                }
-                return instance;
-            }
-        }
-
-
-        public LoginViewModel GetLoginViewModel()
-        {
-            if(vm == null)
-            {
-                vm = new LoginViewModel();
-            }
-            return vm;
-        }
-
-        public void clear()
-        {
-            vm = null;
-            HiveServiceLocatorWeb.clear();
-        }
-    }
-}
Index: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/WebLoginService.cs
===================================================================
--- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/WebLoginService.cs	(revision 13739)
+++ branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/WebLoginService.cs	(revision 13739)
@@ -0,0 +1,127 @@
+﻿using HeuristicLab.Clients.Hive.WebJobManager.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace HeuristicLab.Clients.Hive.WebJobManager.Services
+{
+    /// <summary>
+    /// A service that will handle all the logins and will serve as a singleton that controls
+    /// all the necessary Services used by Hive. (HiveServiceLocatorWeb and HiveClientWeb instances per user). 
+    /// Users are identified with a seperate Guid made by the web version to ensure login security.
+    /// </summary>
+    public class WebLoginService
+    {
+        private static WebLoginService instance;
+        private List<LoginViewModel> loggedIn;
+        private List<HiveServiceLocatorWeb> locators;
+        private List<HiveClientWeb> webclients;
+        private List<FileOpeningService> fileopeners;
+        /// <summary>
+        /// Service instance that keeps all the information per user seperated. 
+        /// </summary>
+        public static WebLoginService Instance
+        {
+            get
+            {
+                if (instance == null)
+                {
+                    instance = new WebLoginService();
+                }
+                return instance;
+            }
+        }
+        /// <summary>
+        /// Initialize all lists
+        /// </summary>
+        public WebLoginService()
+        {
+
+            loggedIn = new List<LoginViewModel>();
+            locators = new List<HiveServiceLocatorWeb>();
+            webclients = new List<HiveClientWeb>();
+            fileopeners = new List<FileOpeningService>();
+        }
+        /// <summary>
+        /// Creates a new entry for a user. Services will be kept running here untill the user logs out or times out. 
+        /// </summary>
+        /// <param name="log">LoginViewModel from new user</param>
+        /// <param name="loc">HiveServiceLocatorWeb created during login</param>
+        public void newLogin(LoginViewModel log, HiveServiceLocatorWeb loc)
+        {
+            destroyPossiblePreviousSessions(log.loginName);
+            var ind = loggedIn.Find(x => x.loginName == log.loginName);
+            if (ind != null)
+            {
+                logout(ind.userId);
+            }
+            loggedIn.Add(log);
+            locators.Add(loc);
+            var temp = new HiveClientWeb(loc, log.userId);
+            webclients.Add(temp);
+            var temp2 = new FileOpeningService(log.userId);
+            fileopeners.Add(temp2);
+        }
+
+        private void destroyPossiblePreviousSessions(string client)
+        {
+            var ind = loggedIn.FindAll(x => x.loginName == client);
+            foreach (var i in ind)
+            {
+                locators.RemoveAll(x => x.UserId == i.userId);
+                webclients.RemoveAll(x => x.UserId == i.userId);
+                fileopeners.RemoveAll(x => x.UserId == i.userId);
+                loggedIn.RemoveAll(x => x.userId == i.userId);
+            }
+
+        }
+        /// <summary>
+        /// Returns the service locator for a user
+        /// </summary>
+        /// <param name="id">User id</param>
+        /// <returns></returns>
+        public HiveServiceLocatorWeb getServiceLocator(Guid id)
+        {
+            return locators.Find(x => x.UserId == id);
+        }
+        /// <summary>
+        /// Returns HiveClientWeb for a user
+        /// </summary>
+        /// <param name="id">User id</param>
+        /// <returns></returns>
+        public HiveClientWeb getClientWeb(Guid id)
+        {
+            return webclients.Find(x => x.UserId == id);
+        }
+        /// <summary>
+        /// Returns the LoginViewModel for a user
+        /// </summary>
+        /// <param name="id">User id</param>
+        /// <returns></returns>
+        public LoginViewModel getLoginViewModel(Guid id)
+        {
+            return loggedIn.Find(x => x.userId == id);
+        }
+        /// <summary>
+        /// Returns the FileOpenerService for the user
+        /// </summary>
+        /// <param name="id">User id</param>
+        /// <returns></returns>
+        public FileOpeningService getFileOpener(Guid id)
+        {
+            return fileopeners.Find(x => x.UserId == id);
+        }
+        /// <summary>
+        /// Removes all traces from the logged in user
+        /// </summary>
+        /// <param name="id">User id</param>
+        public void logout(Guid id)
+        {
+            loggedIn.RemoveAll(x => x.userId == id);
+            webclients.RemoveAll(x => x.UserId == id);
+            locators.RemoveAll(x => x.UserId == id);
+            fileopeners.RemoveAll(x => x.UserId == id);
+        }
+    }
+}
