MVC. Placing Javascript Files In View Folder

When you need to split layout and JS code to different files, it might be convenient to place both files in Views/{ControllerName} folder. You need to change web.config file inside Views folder.

1. Add handler in <system.web> section

2. Add handler in <system.webServer> section before BlockViewHandler

Now you can include JavaScript file in your layout page.

Leave a Reply

Your email address will not be published. Required fields are marked *