/// <summary>Gets the given request.</summary> /// /// <exception cref="ArgumentNullException">Thrown when one or more required arguments are null.</exception> /// <exception cref="FileNotFoundException">Thrown when the requested file is not present.</exception> /// /// <param name="request">The request to get.</param> /// /// <returns>An object.</returns> public object Get(PartialFile request) { if (request.RelativePath.IsNullOrEmpty()) throw new ArgumentNullException("RelativePath"); string filePath = "~/{0}".Fmt(request.RelativePath).MapProjectPath(); if (!File.Exists(filePath)) throw new FileNotFoundException(request.RelativePath); return new HttpResult(new FileInfo(filePath), request.MimeType); }
/// <summary>Gets the given request.</summary> /// /// <exception cref="ArgumentNullException">Thrown when one or more required arguments are null.</exception> /// <exception cref="FileNotFoundException">Thrown when the requested file is not present.</exception> /// /// <param name="request">The request to get.</param> /// /// <returns>An object.</returns> public object Get(PartialFile request) { if (request.RelativePath.IsNullOrEmpty()) { throw new ArgumentNullException("RelativePath"); } string filePath = "~/{0}".Fmt(request.RelativePath).MapProjectPath(); if (!File.Exists(filePath)) { throw new FileNotFoundException(request.RelativePath); } return(new HttpResult(new FileInfo(filePath), request.MimeType)); }