If .js files and css file are in view folder then they are not getting served. ANy idea what fix is required to make them both work if residing in same folder.
Path : Views\Shared\Javascripts
Views\Shared\abc.cshtml
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you look in the
~/Views(or~/Areas/<area name>/Views, if you are using areas) folder, you’ll notice a web.config that prevents any resources from being served from that location. While you could edit that web.config to allow your static assets to be served, I would strongly caution you against this.Instead, place the assets in another folder. By default MVC projects have a
~/Contentand~/Scriptsfolder (CSS/images and JS, respectively). I’d encourage you to just stick to those folders.Edited to reflect recent edit
Say you have
abc.js. Move it to~/Scripts/abc.js. You can include that script inabc.cshtmllike this: