public ActionResult Index(string username, string password, bool takeFreshSnapshot = false) { var user = _membershipService.ValidateUser(username, password); if (user == null) { Response.StatusCode = (int)HttpStatusCode.Unauthorized; Response.End(); return(new HttpUnauthorizedResult()); } _authenticationService.SignIn(user, false); if (!_authorizer.Authorize(ContentSyncPermissions.ContentExportApi)) { Response.StatusCode = (int)HttpStatusCode.Unauthorized; Response.End(); return(new HttpUnauthorizedResult()); } if (takeFreshSnapshot) { _snapshotService.TakeSnaphot(); } var snapshot = _snapshotService.GetLatestSnaphot(); if (snapshot == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; Response.End(); return(new HttpNotFoundResult("No snapshots were available to download. Either manually create a snapshot on the remote site, or add 'takeFreashSnapshot=true' to the querystring of this request.")); } var fileName = string.Format("Snapshot-{0}-taken-{1:yyyyMMddHHmmss}-from-{2}.xml", snapshot.Id, snapshot.TimeTaken, _shellSettings.Name); return(File(Encoding.UTF8.GetBytes(snapshot.Data), "text/xml", fileName)); }