Location of JavaScript files in ASP.NET Core Areas -


i creating asp.net core application contain several areas. add javascript files specific area (usually put them wwwroot\js folder. there area?)?

"where add javascript files"? answer can choose location based on requirements , convenience. default location content root i.e. wwwroot folder , subfolders asp.net core doesn't stop placing static files outside "wwwroot" folder. if want place outside default content folder i.e. wwwroot need tell asp.net core content files located. way tell asp.net core configure staticfiles middleware follows:

app.usestaticfiles(new staticfileoptions() {     fileprovider = new physicalfileprovider(         path.combine(directory.getcurrentdirectory(), @"mystaticfiles")),     requestpath = new pathstring("/staticfiles") }); 

here mystaticfiles folder outside wwwroot , located inside project directory.

now if want access file inside mystaticfiles folder using following path.

http://<myapp>/staticfiles/myscript.js 

note "staticfiles" in above path , in middleware configuration.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -