protected FoireMusesConnection GetConnection() { FoireMusesConnection connection = new FoireMusesConnection(new XUri(Configuration.ApiUrl + ":" + Configuration.ApiPort + "/" + Configuration.ApiAt), Configuration.ApiUsername, Configuration.ApiPassword); if (!User.Identity.IsAuthenticated) { return(connection); } else { // Enables the remote process to use the user's credentials instead of this process' credentials //use settings to create default creditentials to be used by the server. //use some secret key connection.Impersonate(User.Identity.Name); return(connection); } }