问题
I've got two questions about Asp.Net MVC areas. I have only a shallow understanding of areas from what I've heard about them in various podcasts but I think I understand fairly well what they're supposed to be used for. Now my question is if I could also use them to enable me to gradually switch from development in Asp.Net webforms with VB to Asp.Net MVC with C#.
- Can I mix areas of different languages in one application, for example one area is a C# project and another is a VB.Net project.
- Could I use the areas feature to incorporate MVC into an existing webforms application? Lets say I have a Asp.Net webforms application but I want any new "pages" to be written using MVC, could I create a new MVC project and then "jack it in" as an area into the existing webforms application?
回答1:
In response to your questions:
- Yes. If it's a separate assembly, then it won't matter if it's in c# or VB.net.
- I'd say yes - it will help to keep your MVC stuff separate, but of course you will need the basic bootstrap stuff in your base webforms project. Good idea.
I've recently started introducing MVC into an older webforms site, and it's well worth the effort.
来源:https://stackoverflow.com/questions/1841520/asp-net-mvc-areas-how-can-i-use-them