user712923
user712923

Reputation: 1555

Areas in mvc3 .Does it make sense to use them?

I am building an asp.net mvc3 application and I have decided to use areas and wondering if it's a good idea. Yes they should provide separation but they are still in your main project. How do you build a project with modules(EG Orchard) what is the approach.Any tutorials?

Please note that I am new to web (winform guy) so bear with me.

I have now a problem with areas? I am getting javascript errors as if it cannot find them? eg "$ is undefined " etc... Are you supposed to have the reference to the javascript folder? Why I am getting errors in areas and not in the other parts of the web app?

THanks a lot

Upvotes: 0

Views: 770

Answers (2)

Serge Wautier
Serge Wautier

Reputation: 21878

Areas are helpful for bigger sites. They help separate the site in different... areas(!): Subdirectories of your site (from URL point of view).

Admin is probably the most common area: It contains several actions/views gathered in their own admin/ subdir of your site.

Upvotes: 0

MartinHN
MartinHN

Reputation: 19772

I use areas. I have an Admin area inside my application, and Areas in MVC works just fine for me.

Regarding the JavaScript errors, I think the problem is the reference to the JavaScript files from your Area's Layout/Master file. The reference may be relative?

You probably want to refer to them as /Scripts/MyJavaScriptFile.js - given that the JavaScript files is located in a folder called Scripts in the root of your application. Not inside the Area's folder structure.

Upvotes: 1

Related Questions