private async Task <DrapoDynamicResponse> HandleRedirect(DrapoDynamicRequest request) { DrapoDynamicResponse response = new DrapoDynamicResponse(); response.Status = 302; response.Headers = new Dictionary <string, string>(); response.Headers.Add("Location", request.Path.Replace("redirect", "DrapoPages")); return(await Task.FromResult <DrapoDynamicResponse>(response)); }
private async Task <DrapoDynamicResponse> HandleView(DrapoDynamicRequest request) { string path = this._environment.WebRootPath; string filePath = this.GetHandleViewPath(path, request.Code, request.Context, out bool isContext); if (string.IsNullOrEmpty(filePath)) { return(null); } DrapoDynamicResponse response = new DrapoDynamicResponse(); response.IsContext = isContext; response.Content = File.ReadAllText(filePath, Encoding.Unicode); response.LastModified = File.GetLastWriteTime(filePath); return(await Task.FromResult <DrapoDynamicResponse>(response)); }