B
B
bullock2017-10-30 12:57:23
ASP.NET
bullock, 2017-10-30 12:57:23

ASP.NET doesn't see static files in Views/Home folder?

I am writing a project on ASP .NET MVC 4 In the View\Home folder there is an image bg.jpg but when you try to access it localhost:14066/Home/bg.jpg HTTP Error 404.0 - Not Found occurs and naturally this code does not work:

<style> .body { background-image: url("bg.jpg"); } </style>

And I'm also trying to connect external css, but it also does not connect, although it is in the same folder with Index.cshtml How to be?
59f6f77a17621978225178.png59f6f77dcd95b970469864.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nemiro, 2017-10-30
@bullock

The file is physically located in the /Views/Home/bg.jpg folder , but most likely this will not work. The /Views folder is for view files, partial views, and templates only. Normal (expected) processing of files in this folder should be disabled by default. The /Content
folder is for static files . For script files, you can use the /Scripts folder .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question