Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private IHttpResponse ReturnIfResource(string path)
- {
- //<script src="/resources/js/jquery-3.3.1.min.js"></script>
- string pathTofile = $"../../..{path}";
- bool fileExist = File.Exists(pathTofile);
- if (!fileExist) return new HttpResponse(HttpResponseStatusCode.NotFound);
- string fileToBytes = File.ReadAllText(pathTofile);
- var bytesTransform = Encoding.UTF8.GetBytes(fileToBytes);
- return new InlineResourceResult(bytesTransform, HttpResponseStatusCode.Found);
- }
Advertisement
Add Comment
Please, Sign In to add comment