private static HttpResponseMessage AWallOrError(string wallId) { var result = TableStorage.GetEntity <TemporaryUrl>(Constants.TableNames.TemporaryUrl, wallId, wallId); if (result == null) { var path = string.Format($"{wallId}/wall"); if (!BlobStorage.BlobExists(Constants.BlobContainerNames.Wall, path)) { return(new HttpResponseMessage(HttpStatusCode.NotFound)); } var tempUrl = CreateTemporaryUrl(wallId); _log.Info("Wall redirected to: " + wallId); string redirectPath = RedirectPath + tempUrl; var response = new HttpResponseMessage(HttpStatusCode.Redirect); response.Headers.Location = new Uri(new Uri(_host), redirectPath); return(response); } else { if (result.Expiry >= DateTime.UtcNow) { var html = BlobStorage.GetBlobText("$web", "index.html"); var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(html) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return(response); } else { return(new HttpResponseMessage(HttpStatusCode.Forbidden) { Content = new StringContent("F**k off") // Brutal. Consider revising. }); } } }