コード例 #1
0
        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);
        }
コード例 #2
0
        public object Get(PartialFile request)
        {
            if (request.RelativePath.IsNullOrEmpty())
            {
                throw new ArgumentNullException("RelativePath");
            }

            string filePath = "~/{0}".Fmt(request.RelativePath).MapProjectPlatformPath();

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException(request.RelativePath);
            }

            return(new HttpResult(new FileInfo(filePath), request.MimeType));
        }