How should I approach a Sharepoint 2010 development project coming from WebForms and MVC? - asp.net

I have a good amount of knowledge in the ASP.NET Webforms and MVC worlds. Shortly I will be tasked with implementing custom web applications with Sharepoint. I have great flexibility with this project (i.e - I can use custom web apps outside of Sharepoint if that's possible) but like most projects the most limiting factor I have to deal with is time.
Here are some questions that come to mind:
Can I easily integrate a custom MVC project into Sharepoint 2010? What are the pros and cons if I can?
Same as #1 only with Webforms.
If #1 and #2 are not viable solutions, can I easily create custom web applications within the Sharepoint world? What will the learning curve be with my background?
I understand developers can now use Windows 7 to deliver Sharepoint 2010 solutions. It looks like I can use a trial of Microsoft Sharepoint Foundations 2010. If that's correct, are there any development differences or gotchas I need to be aware of before digging into the Foundation version? I don't want to get up to speed on Foundation and then find out that the Server edition (the version that will be deployed) is vastly different.
Thanks!

SharePoint is based on webforms - it is relatively easy to add custom user controls and web parts, though if you want to use SharePoint data in a completely custom web app, especially mvc you will probably need to host it seperately - you can access everything you need through the SharePoint API, but it makes the deployment a lot more complicated.
The workarounds to get webforms mvc running in the SharePoint web app tend to involve stuff that would never get past corporate infrastructure people, but I've been getting good results with precompiled razor views set up based on http://razorengine.codeplex.com/ - my version that produces code which can be included in a SharePoint project is at https://github.com/tqc/RazorEngine
In the 2007 version there were significant architectural differences between WSS and MOSS. With 2010 there aren't as many differences, so you should be ok, but it would still be better to develop on the same version you are deploying to - download a trial of Standard or one of the demo VMs - If you do a lot of .net development, chances are you already have an appropriate dev license.

What are you trying to accomplish? Are you connecting your MVC site to SharePoint or are you building something "MVC" on top of the SharePoint server?
In any case, there is an MVC SharePoint project on Codeplex here http://sharepointmvc.codeplex.com/
Here is an article on the subject http://blogs.msdn.com/tom/archive/2009/03/17/asp-net-mvc-and-sharepoint.aspx
I havent touched it, and it seems a bit abandoned to me, but it might get you along.
Check out it outlines one method of running MVC with SharePoint
Generally, SharePoint will simplify many user-oriented requirements you may have - such as authentication, permissions control and personalised areas (with MySites).
If you go with SharePoint, you almost have to build your product for SharePoint Foundation so that you can keep your customers' total costs low (SharePoint CALs, SQL Server, hardware, etc). You'll want to build friendly user interfaces for managing permission, allowing your users to create their own pages, and other provisioning tasks -- or provide rock-solid documentation on how to do it out of the box with SharePoint. With SharePoint, you should use features and Web Parts to deploy your code either way , whether SaaS or on-premise. That will make it easier to deploy and upgrade.

Related

Building transactional web application using SharePoint

Disclaimer: I do no have extensive SharePoint/.NET experience, mostly read through online Microsoft docs, so asking opinion in this forum.
I am modernizing 2 legacy microsoft apps. One is SharePoint 2013 site used for CMS and other is ASP.NET 2.0 web application having transactional frontend. New combined frontend must be JS based common for all screen sizes. Business wants most cost-effective solution, preferably on-prem. I am bit confused about the approach to unify both. 1) Upgrade path - Put ASP.NET into SharePoint farm and then modernize the UI pages. 2) Rewrite with SharePoint frontend - Build using SharePoint Framework (SPFx) which internally supports modern JS frameworks. 3) Rewrite without SharePoint frontend - Build a common JavaScript UI portal (ReactJS) and access the backend REST APIs (including SharePoint) sitting behind an API Gateway.
For Cost effective solution, don't use spfx / ReactJS. Their development environment settings are costly and expired in sometime by new version sooner.
One can rewrite using jsom in SharePoint online , as SharePoint online provides a very good code editor .
JSOM all operations are below :
https://www.codesharepoint.com/jsom/0/all-methods
Approach 1 (ASP.Net in SP Farm) - I would not consider this 'modernizing' as Microsoft's approach going forward is using front-end javascript based applications, which are extremely powerful with the amount of AD integration/Graph libraries/etc. made available. This feels dated in my eyes and could create issues down the road if the company ever wishes to migrate to SharePoint Online.
Approach 2 (SPFx) - This is where the Microsoft ecosystem is flowing with SharePoint modifications. It's also easy to tie into back-end services or other services using Azure App Registrations. There is a lot of flexibility here, you have the option to use ReactJS as well, among other frameworks. I would recommend this approach
Approach 3 (Custom App) - I have built solutions running off create-react-app and similar frameworks and I still try to leverage SharePoint if it is a significant part of the ecosystem as they have very powerful frameworks for tying into it such as PnPjs. It just makes integration so much easier, and you are working within the context of SharePoint vs a custom application on some other server which must be wary of authentication as well as the potential need of a back-end service for communication to SharePoint.

Use OrchardCMS, Umbraco or DotNetNuke as a component in ASP.NET application

OrchardCMS, Umbraco and DotNetNuke are CMSes in .Net galaxy. They work as stand alone applications well. Suppose I have a requirement that need CMS features in an another ASP.NET MVC application. I do not like to implement CMS again in the application. Rather I like to use current CMSes as a component of application.
Is it possible at all to use for example OrhcardCMS as a component of my MVC application? It is ideal to have relations between CMS and application itself, for example I can load entities from CMS, update them etc.
I know there are integration techniques in .Net. For example ASP.NET Identity integrates with ASP.NET applications in core level, but view (CSHTMLs) must be copied and customized in most cases. Or Hangfire and ELMAH that integrates with an application without need to copy view (cshtml, html, css) to the target application. Indeed it is good to know that integration methods are available regarding plugging CMSes into ASP.NET applications.
I can tell you more about Umbraco as I don't know other CMS as much as this one. There is a whole course / training for those who want to integrate their apps with Umbraco: https://umbraco.com/products-and-support/training/umbraco-application-integration/. So yes, it's possible and it's even suggested way from my perspective to use already done piece of software rather than building the wheel once again.
Umbraco is an ASP.NET MVC application. You can use Umbraco components, backoffice, membership and everything else CMSish delivered out of box and still you're able to write and use your business logic, controllers and everything else what you've created inside your ASP.NET MVC / C# app. Still, it's an ASP.NET app, so you can use anything what you want from the .NET world. We're using ELMAH.io for example to take care of logging and keeping the errors in the cloud. We're also using a ton of 3rd party, both open-source and commercial tools and softwares to do multiple things around our web components. Umbraco is not blocking us from using them or anything else. I like to consider Umbraco as a framework or library helping us to deal with content editing and giving us a massive number of opportunities to offer for our clients or editors.
Speaking for OrchardCMS, there are some questions touching this subject already, see
Reusing Orchard's Core to build another extensibility framework
Extracting a Module from Orchard
If it's possible for you then try to setup Orchard as the base system and move your MVC application in a module. This will be much easier than trying to cut out peaces of Orchard. In return you get amazing possibilites when running Orchard as the underlying framework, e.g. Localization, Modules, Themes, the whole user / role management etc.
OrchardCMS 2 is currently developed towards single components that can be reused in any application but it's far from finished yet.

Best practise to migrate Web Forms to ASP.NET Core MVC

I am trying to migrate a project from classic ASP.Net Web Forms to ASP.NET MVC.
While I have read through http://www.codeproject.com/Articles/38778/ASP-NET-WebForms-and-ASP-NET-MVC-in-Harmony. I have a basic idea on how the code structure, libraries and routing should be done.
For your information, the scope of my existing project is around 400 pages and 300 tables.
On top of my head I have two approaches:
Start from stretch, rewriting the whole system - Obviously this would require intensive work and take a long time. Any change made on existing system would need a duplicate change made to the new system.
Migrate the page one each - I still have a rebuild the entire core library (for accessing db), and get the page migrated one by one. For this I would assume to have two core libraries (new and old) running simultaneously with different pages connect to one of those.
Would anyone have similar experience and advise a proper way to start?
For this complete revamp I may also target at the latest technology - .NET Core and MVC6, by taking these would I have extra advantage, or some blockages I would have to take care of?
Any suggestion and opinions are appreciated. Cheers.
Microsoft is a bit hush hush on the subject but the WebForms engine is probably never going to make its way to ASP.NET Core. One might think that MS is waiting to see if the community is calling for a port, but I think they're trying to kill it discretely (not like Silverlight).
Why? Because it proved to be a bad good idea on the long run, easy to use at first, but extremely complex to master (because of viewstate and page lifecycle), with a tendency to allow average developers to build very tedious application (in french we say steam factories). Also it was very poorly adapted to modern web development (Ajax, unit testing, IoC). They tried to fix it with a couple of tweaks, but the overall architecture is just not adapted to this kind of things. MVC is a treat in comparison!
To answer your question, it's not really possible to migrate WebForms to MVC, because those are quite different architectures, and of course the architecture is what an application sits on top on, so if you change it, you might as well rewrite it from scratch.
What can help you a lot is if your app is divided in tiers (business, data access, UI). If it's not the case, you could start by doing this, properly separating the UI project from the rest. Then you would just have to rewrite the ASP.NET project and not the rest.
There are some useful resources I'd like to share with the StackOverflow community just in case you are having troubles to decide what to do:
modernization of your existing Web Forms app
migration to MVC or Core
or whether to start a new project on Web Forms, MVC and Core.
Here you go:
https://www.telerik.com/blogs/review-of-telerik-toolsets-for-aspnet-web-forms-core
Modernizing ASP.NET Web Forms Applications by Tomáš Herceg (Microsoft MVP ) - https://tomasherceg.com/blog/post/modernizing-asp-net-web-forms-applications-part-1
Migrating Old ASP.NET Applications to .NET Core by Edi Wang (Microsoft MVP) - https://edi.wang/post/2018/10/31/migrating-old-aspnet-applications-to-net-core
Choose between ASP.NET and ASP.NET Core (Microsoft docs) - https://learn.microsoft.com/en-us/aspnet/core/fundamentals/choose-aspnet-framework?view=aspnetcore-3.1
Migrate from ASP.NET to ASP.NET Core (Microsoft docs) - https://learn.microsoft.com/en-us/aspnet/core/migration/proper-to-2x/?view=aspnetcore-3.1
i have come across below links
https://www.youtube.com/watch?v=CZuqMrWSano
https://www.dotvvm.com/blog/59/Modernizing-ASP-NET-Web-Forms-applications-with-DotVVM
DotVVM package helps us to migrate ASP.Net Web Forms migration to ASP.NET Core without re-writting completely.
i have not tried any production application. still have tried some sample pages. you can try this out.
I can agree that for many cases a re-write of an ASP.NET application where WebForms is used widely may do not provide any business value.
Therefore we decided to use our experience with ASP NET WebForms to develop a highly compatible port of WebForms for ASP NET Core / .NET 6.0.
We use the solution in our own ASP NET WebForms-based products and projects as well as a licensable component library.
So the Forms can still be used and you can focus on the .NET CORE/6 migration.

Web Matrix: should I use it if I am already well versed in VS?

I have been reading a bit about Web Matrix, I like the simpleness of it. But should I even bother if I am already using VS2010 pro? I was thinking maybe for small clients that want a simple site with a blog it may make things quicker? Is it worth looking more into?
And if I do make a simple site with wordpress with web matrix, I should still be able to host it on an apache server, even though web matrix is a microsoft product?
thanks!
The question could use some tweaking. You're asking which IDE to use, but you you really mean simple - (Web Pages and or Packages like WordPress) vs complex - traditional ASP.Net (Web Forms and or MVC).
That said, Microsoft is acknowledging the various minimalist movements going on in their community. People are rejecting the idea that the complexity of the ASP.Net, WCF, IoC, DDD is necessary in every project.
Out of this movement you see projects like OpenRasta and OWIN are pushing for simpler servers and services. While projects like Nancy look to simplify the application stack. And dapper and massive both are attempts to simplify data access.
Microsoft's answers to this are asp.net web pages, supporting php, and things like WCF Web API.
For your own direction, you need to decide if the benefit of having a simpler option is worth the effort of learning multiple frameworks (say web pages for simple and mvc for complex), or if you want to only know one framework and pay a productivity penalty when putting the proverbial square peg in a round hole.
WebMatrix is about the programming framework rather than the IDE. You can use VS to create WebMatrix sites, which has several benefits over the WebMatrix IDE including Intellisense. In fact if you open a site in the WebMatrix IDE and have VS installed you will get an "Open in Visual Studio" icon on the toolbar.
I would definitely recommend using WebMatrix for smaller sites.

New to ASP.NET

I am wanting to learn ASP.Net and am just a beginner. I have done some windows c# forms development before but have no experience of web development.
I have looked at the ASP.net website but beyond this, does anyone have any ideas as to good learning resources particulary in relation to the differences to windows development. For instance, It seems that the way events work is quite different under ASP to windows forms.
Thanks you all.
Thank you very much. I will have a look at MVC. It looks even more complicated but if this is the way things are going then I would be better maybe to invest my learning in this.
I would advise you at this stage in ASP.NETs life to instead direct your attention at ASP.NET-MVC. This url http://www.asp.net/mvc/ is a very good resource for learning.
ASP.NET Forms do a good job of hiding the nature of a connection-less HTTP/browser based technology and presenting a familiar Form with controls and lots of useful events environment that Windows Forms developers are used to.
However this approach comes with a price. For any serious project there is no avoiding getting under the hood of ASP.NET forms and properly understanding the underlying technology. At this point you start to realise the significant compromises the ASP.NET Forms has had to make in order to make Windows Forms developers feel at home.
ASP.NET-MVC, on the other, makes no such compromises. Learning MVC means learning how HTTP works up-front. It also has the advantage of being a much more test friendly approach which when used properly will save you days of debugging.
ASP.NET website - seriously, it's a really good resource.
I'd seriously consider starting with ASP.NET MVC. You'll end up learning what you need from ASP.NET "classic" but you'll pick up all the goodness of MVC (testability, seperation of concerns in your code etc) instead of learning bad habits.
Google for "ASP.NET MVC", check out ScottGu's blog, Scott Hanselmans's blog, or search StackOverflow for ASP.NET MVC (use the ASP.NET MVC tag too).
One good place to start...
http://weblogs.asp.net/scottgu/archive/2009/04/01/asp-net-mvc-1-0.aspx
I know they are a bit out of date, but I still think the two Fritz Onion books give a great look at what's happening in ASP.NET under the hood.
Some resources:
asp.net (as you mentioned)
channel9
scott hanselman's blog (some useful entries)
Windows Client Homepage
W3Schools Tutorials (Useful for more than just .NET, but this is the .NET page)
I've been a .NET Windows Forms (not Web forms) developer for 1 and a half years. Then I switched jobs and started using WebForms for like... 2 years. Then I discovered ASP.NET MVC (January 2008) and since then although I still master ASP.NET WebForms I will always prefer ASP.NET MVC.
My recommendation also goes into ASP.NET MVC. You will have to learn HTTP, HTML and a bit of Javascript but after these you will master web development on ALL PLATFORMS.
A great alternative to ASP.NET MVC is ASP.NET Web Pages with Razor syntax. In fact, the latest release of ASP.NET MVC and the latest release of ASP.NET Web Pages both use the same view engine.
Here is a link to the complete ASP.NET Web Pages book:
Getting Started with WebMatrix and ASP.NET Web Pages
Also, here is the complete WebMatrix Content Guide:
WebMatrix Content Guide
Here's the description:
WebMatrix is a free, lightweight set of web development tools that provides the easiest way to build websites. It includes IIS Express (a development web server), ASP.NET (a web framework), and SQL Server Compact (an embedded database). It also includes a simple tool that streamlines website development and makes it easy to start websites from popular open source apps. The skills and code you develop with WebMatrix transition seamlessly to Visual Studio and SQL Server.

Resources