I started building an asp.net webform application. Gradually, I moved all the presentation logic to javascript. I removed all the postbacks and replaced those with calls to web services that receive, process and return json data. I use javascript to generate HTML based on the json I receive from my web services: no gridview to generate tables, everything is generated on the page.
I’m at the point where the aspx pages don’t have any code behind any more. I moved all the logic into code libraries in my AppCode folder. I’m not using the viewstate. I’m left with a master page that uses several literals to inject user data on load; the master page has some code behind to manage this process. The main webform functionality I’m using is membership management: I have one login page and one button on the master page that triggers the log out on postback.
Eventually, the entire front-end will work as a one-page application.
How far am I from having an MVC application? Should I keep the structure of my application as is or is there going to be a benefit to moving to an MVC app?
The main difference between WebForms and MVC in easy terms: in WebForms you essentially call a view (“MyPage.aspx”) which has some additional logic/code attached to it. In MVC you call a remote function (action) like “products/detail” which contains logic and decides what to return to the browser (for example a view, but it could be json, javascript or whatever). So according to your description, those “remote methods” would conceptually work well as an alternative to your web services.
But as you’re using the web forms part only for rendering the initial web page and use web services for all the rest, I doubt that there wouldn’t be that much benefit from moving to MVC now. The new WebAPI could be interesting for you, but if you already have your services in place I don’t know if you should move now.
Membership isn’t any different between WebForms and MVC, so there’s no need to change anything here.
I’d say: if your current design works, leave it at that for now.