Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...


What files, directories, and lines do I need to create in order to get an MVC page working in v10?

(I asked a similar question to this on StackOverflow, but from the answer I got, it quickly became clear that some things are different in ASPDNSF. This is also an extension of my previous question about how to deal with having a bunch of Web Forms applications that don't work under MVC.)

My company's store has several custom pages, all written in old Web Forms architecture, and I've now resigned myself to translating them into the MVC paradigm. But I don't know where to even start with creating a page. In v9, I would just open up a text editor, create two new files (.aspx and .aspx.cs), and copy-paste-adjust some front matter from a similar page; I'd ftp those files onto our server, and voilĂ , a usable page, and it even inherits the master page template.

With MVC, nothing is obvious to me yet about where to put files or what to put in them. I've tried with no luck to create a .cshtml page that shows any data at all.

Everything on the internet seems to say I should be using Visual Studio to create these pages, but I've so far had no success in duplicating the whole store and database into a local directory and then getting it up and running. I do have a copy of the original AspDotNetStorefront directory with the VS .sln in it, but that's the out-of-the-box code; our host has already gotten a development version of the v10 site up and working and I've tinkered with it to bring in old CSS and layouts, so I'd like to work from that base that's already available on our server.

Is it possible to do this with just a text editor, or am I going to need to use VS to recompile some DLLs? The prospect of that frankly scares the bejesus out of me and I already deeply miss v9 where everything was in plain sight. 

To sum up, what I'd like to know is: What do I write, and where, in order to create a working page in MVC? Once I've managed to create some page I should probably be able to get up and running, but as of now I'm going on two weeks being completely baffled (and I'll admit infuriated) with MVC.

asked Jul 12, 2016 in MultiStore by Nathanael (425 points)

1 Answer

0 votes
Best answer
You're definitely going to need Visual Studio, yes.  Even if you wanted to go through trying to do all the dev without Intellisense and all the rest of the handy tools in VS, you're going to have to rebuild eventually.  v10 is set up as a web application instead of a website in VS, so eventually almost everything ends up compiled into a DLL.

As far as 'what do I write, and where' - that's a pretty big question that really boils down to needing to learn MVC.  There are certainly things about ASPDNSF that are a little different than you'll run into on other MVC products (lots of which will have their own little weirdnesses), but the basic concepts are all there, so most of the resources you'll find online will be helpful.

A really good place to start would be to get everything opened up in Visual Studio, and then find a simple 'page' that you can start poking around in to get a feel for things.  What a lot of devs who are still learning MVC do is start with a simple example (or one with functionality close to what they're trying to create), copy and rename the 3 elements that power it (do this in VS, so the new files get included in your solution), and then start changing things.

For example, the 'contact us' page - it's pretty simple and standalone, but has some functionality behind it so you can poke around in the logic and see how things are organized.  You'd make a copy of Views/ContactUs folder (what people see), the AspDotNetStorefront.Controllers\ContactUsController.cs (the logic behind the page), and AspDotNetStorefront.Models\contactUsViewModels.cs (the objects that hold data passed to/from this page).
answered Jul 12, 2016 by Vortx ScottS (13,500 points)
selected Jul 12, 2016 by Nathanael

Follow-up question: all the routing information, and the controllers, are in DLLs. Does this mean that the process of making a page also necessitates owning, changing, and recompiling the source code? (At this point in learning MVC I have no idea whether it's possible to make, say, a separate routing table for pages built on our end.)

It's possible to add new pages without the source, but it's a much bigger deal than if you have the source.  We sell a guide on how to do it (the first option here), but it requires some pretty complex development work.