Dedicated to development, configuration, and tips and tricks for both WSS 3.0 and MOSS

Electronic Forms: InfoPath or ASP.NET?

Posted by Aaron Varga on Saturday, 14 Feb 2009 10:40

Lately we’ve been getting a number of requests for solutions that will require the use of forms, and the first reaction is usually “let’s use InfoPath”.  InfoPath is great for what it does, and is horrible for what it doesn’t.  This post will attempt to offer pros and cons for both InfoPath and ASP.NET ASPX forms, and hopefully will allow you to recommend the correct approach for an electronic forms solution.  This post assumes you’re considering InfoPath Forms Services (browser-enabled forms), as opposed to using the InfoPath client.


InfoPath Forms

Let’s begin by taking a look at InfoPath.  InfoPath is a great tool for creating simple data-entry forms, and for retrieving data from a variety of data sources.  In addition, it’s great when you need to submit data to a SharePoint form library for the purposes of leveraging a SharePoint workflow.  Where InfoPath breaks down is when we need to submit data to other sources, or when we need to provide a rich user-interface with robust controls and data validation.  Let’s take a look at some pros and cons of InfoPath:

Pros

  • Great for submitting data to SharePoint or a SharePoint workflow
    Most of the time when we’re using electronic forms, it is to support a workflow process.  As you [should] know, a SharePoint workflow runs for a specific list item, and data needed for the workflow needs to be entered into the fields for that particular list item in order for the workflow to see it.  Because of this fact that the data actually needs to be a list item, InfoPath is a great choice, because you can effortless promote form fields as columns in your list, which the workflow can then use.
  • Great for retrieving data
    InfoPath provides a very simple wizard interface for selecting a data source for data retrieval.  You can easily select a web service, and XML document, or a SharePoint list and have that data appear in your form pretty easily.  You can also connect to a SQL database and retrieve data from tables, views, or stored procedures.
  • Great for simple end-user form development
    InfoPath is great for creating a simple form with a few fields and simple rules and simple data validation.  I keep emphasizing simple because once you introduce complex business rules, data validation, conditional formatting, or complex data presentation that pushes the limitations of InfoPath, you will be forced to get very creative which often involves some sort of custom coding.
  • Most of the time only requires SharePoint site permissions
    Unless you are creating a browser-enabled form with .NET code-behind, or your form requires Full Trust and uses the InfoPath client, it’s relatively easy to deploy a form to SharePoint.  Simply publish the form to the desired form library and you’re good to go.  However, as soon as you introduce .NET code in a browser-enabled form, you need to install and activate the form to Central Administration and activate the newly-created feature at the site collection level.  You will need to have access to Central Administration and to the site collection in order to activate these features.

Cons

  • Difficult to submit data to non-SharePoint data sources
    Like I mentioned, InfoPath is great for submitting data to a SharePoint form library.  It is not so great for submitting the data to anything else.  If your form is submitting data to a single (single being the operative word here), then you could potentially configure the form to submit directly to a table.  However if the data needs scrubbed or manipulated, chances are you will need to submit the data via a stored procedure, which InfoPath cannot do.  For this, you will be forced to develop a custom web service that accepts the data either field-by-field, or as a giant blob of XML that you have to parse through, which you then have to submit to the database by writing traditional ADO.NET code.  Not too simple anymore, huh?
  • Limited user-interface
    InfoPath allows you to create forms with a variety of standard controls, such as textboxes, date pickers, radio buttons, checkboxes, buttons, drop-down lists, repeating tables, etc..  Unfortunately, it is pretty much limited to those items (you get a few more with the rich client, but that’s beyond the scope of this post).  You don’t have any type of tree view control, no multi-select list box, no tab control, no image buttons, and no grid view control. The lack of a grid view control is a deal breaker in many cases, because we often have to present long lists of data, and the built-in repeating table doesn’t support sorting, grouping, or paging.  Yuck.  Finally, there’s no way to add HTML or CSS to your form, meaning that it can’t inherit any SharePoint styles, and you’re limited to what you can design in the form.  This frequently gives an inconsistent look and feel for a SharePoint process.  Again, yuck.
  • Difficult to secure sensitive data
    Assuming the InfoPath form is being submitted to a SharePoint form library, any data the form contains is inherently insecure.  The form is just saved to the form library like any other document, except as an XML document.  This means if your form contains social security numbers, salary information, or any other type of sensitive data, a user could download the XML file and open it in Notepad.  Even if the data isn’t visible through InfoPath, the data is still stored in the form and can be viewed by any user that knows how to download.
  • Difficult to integrate with Forms-Based Authentication
    Although browser-enabled forms will work with forms-based authentication, the useful username() function no longer works.  This means that even if you’re logged into your SharePoint site as a valid FBA user, InfoPath will have no idea who you are.
  • Not developer-friendly
    If you’ve made it this far in this post, you’ll have already read that while simple things are easy to accomplish in InfoPath, complicated things aren’t and often requires .NET code.  While you can definitely add .NET code to a form, it’s not the same type of form coding a typical developer is used to.  You have to parse XML to retrieve field values, you have to parse XML to set field values, and you’re still pretty much limited to the functionality that you have through the designer.  You can just write more complex business rules and logic, you can’t make the form or the field controls behave any differently.
  • Licensing
    Obviously your users need to be licensed for InfoPath Forms Services before they’re able to use it. Even if you have licenses for the InfoPath client, separate licenses are required for browser forms. If the users are internal and members of your domain, you must be licensed for InfoPath Forms Services, which is available either through the MOSS Enterprise CAL or the standalone InfoPath Forms Services CAL.  If the forms are going to be available externally to non-domain users or anonymous users, then you must be licensed for either Office Forms Services for Internet Sites or be licensed for SharePoint for Internet Sites, which is the external connector that provides the ability for an unlimited number of users to access and use InfoPath through a browser.

ASP.NET ASPX Forms
Creating ASP.NET ASPX forms offer the most in terms of flexibility, as you can do anything that you can do in a traditional ASP.NET web site, including HTML, CSS, JavaScript, and even AJAX.  A lesser-known technique is integrating these pages into the SharePoint “shell” to give users a seamless experience.  It doesn’t take much effort to have SharePoint host these pages and have the master page and styles applied to your custom forms.  Let’s take a look at some pros and cons associated with ASP.NET forms:

Pros

  • Great for submitting data to non-SharePoint data sources
    While InfoPath is great at submitting data to a SharePoint form library, ASP.NET forms are great for submitting data to everything else.  You can easily write your ADO.NET code or whatever-you-like code to submit to your data source, and not have to worry about parsing a bunch of InfoPath XML first in order to pull out the values.  It’s a lot less work to get the data into your data source.
  • Great for providing a rich user interface
    Unlike InfoPath, you aren’t limited to a tiny set of field controls.  You can use whatever an ASP.NET web site supports, including tree view, tab controls, grid views, AJAX – even Silverlight if you really really want.  You can also provide any type of business rules and validation you like as well, including summaries, friendly pop ups, etc.  Also, since the pages are inheriting the SharePoint styles and master page, your forms will automatically pick these styles up, and will also use the master page.  This gives the appearance that they’re actually built-in SharePoint pages.  It’s slick. There are plenty more options for developing a rich and clean user interface if you’re developing ASP.NET forms.
  • Developer friendly
    This one’s a no-brainer.  Obviously if you’re familiar with ASP.NET and .NET programming, creating data-entry forms are a cinch.  There’s no learning curve with learning how to code an InfoPath form, and you don’t have to learn the ins and outs of the InfoPath object model.  This opens up the development work to a wider audience of our developers, as not many have hands-on experience with writing .NET code behind an InfoPath form.  In addition, should any future updates be required to the form or the code, finding resources on ASP.NET online or hiring someone with ASP.NET skills will not be a difficult task.  It’s a widely practiced technology, and there are a ton of resources.
  • Can provide secure means of sensitive data access
    Since no data is actually stored in the ASP.NET form, it provides a much more secure way of viewing sensitive data, as it will have to be retrieved and submitted to the database directly.  A user can’t download an ASP.NET form and see the data like they can with an InfoPath form.
  • Integrates well with Forms-Based Authentication
    By using an ASP.NET form in an FBA-enabled site, we are able to see the user that is currently logged in, unlike with an InfoPath form.
  • Access to the SharePoint Object Model
    Since the ASP.NET forms are running under the context of the SharePoint site they’re accessed from, we can use the SharePoint Object Model to do whatever we wanted.  We could very easily access SharePoint list or site data, user profile information, etc., and bind that information to controls on the form.  To do this in InfoPath, you’d have to use the unfriendly out-of-the-box SharePoint web services, or write your own.
  • Licensing
    Not required! There aren’t any licensing headaches when exposing ASP.NET forms to users, even externally.  Obviously since they’re going to be integrated into SharePoint, you’ll have to have the appropriate licenses for that, but nothing specific to the forms themselves.

Cons

  • Potential additional development overhead
    Obviously writing custom ASP.NET forms requires a competent ASP.NET developer, which may not always be available (though I’d argue that in order to develop some of the complex forms that we have had to do in the past – you will still need a very competent .NET developer).  In addition, changes to simple business rules or data validation is more difficult to accomplish in ASP.NET than in an InfoPath form.  If the form is simple and doesn’t require data going to SQL, then an end-user is probably better of just using InfoPath.
  • Requires file system access on SharePoint server
    To deploy custom ASP.NET forms to SharePoint, they need to be placed onto each web front-end’s file system.  In addition, the assembly must be deployed to the GAC or to the web site root’s BIN directory.  Either way, the developer must have access to the file system, or to someone that has access to the file system.
  • Not business-user friendly
    One good thing about InfoPath is that business users can even build simple forms.  They will probably not be able to develop an ASP.NET form in .NET.  If the form is truly that simple, then creating ASP.NET forms is probably overkill anyways, and InfoPath should be the recommended solution.

 

So, How Do I Choose?
Great question! The answer should be easy -- do the simplest thing possible that will result in a clean solution.  If you can implement the desired functionality quickly and painlessly in an InfoPath form, then by all means do that.  If developing an InfoPath will actually be prohibitive to functionality and future maintainability, then consider building custom ASP.NET forms.

To make your decision even easier, I built a flowchart that should help guide you.  It does not include every scenario, but does include most scenarios that we deal with:

 image

 

Conclusion
Hopefully this post ironed out some of the confusion surrounding what solution to offer clients for their electronic forms requirements.  In no way should we suggest InfoPath just because “it’s an Office app that integrates nicely with SharePoint”.  In some cases it does, it many cases it does not.  The actual requirements need to be evaluated before jumping on the InfoPath bandwagon.  Trust me, I’ve had my hands in enough complex InfoPath forms, and I know that after a certain point of complexity, doing something in InfoPath is more difficult, more expensive, and plenty more aggravating. InfoPath is merely a mechanism to get data into SharePoint. It should not be used to develop complex data entry forms when the data is going to a non-SharePoint data source.  It’s like trying to make a spoon behave like a Swiss Army knife.  Understand what it does well, and more importantly understand what it does not.

Posted by Aaron Varga | 2 Comments | Trackback Url | Bookmark with:        
Categories: InfoPath, .NET, ASP.NET, Electronic Forms

Links to this post

Trackback from wss.made4the.net: by Jeremy Thake on 20 Feb 2009 02:43

Trackback from Casino 1242955280 on 21 May 2009 08:35

Trackback from sdiywhir on 22 May 2009 08:15

Trackback from Casino 1243045918 on 22 May 2009 10:14

Trackback from Casino 1243052402 on 22 May 2009 11:52

Trackback from Casino 1243056365 on 23 May 2009 12:47

Trackback from Casino 1243115379 on 24 May 2009 01:12

Trackback from Casino 1243365450 on 29 May 2009 10:49

Trackback from txjrzlwq on 18 Jul 2009 10:18

Trackback from qkktivql on 20 Jul 2009 12:34

Trackback from vlydbsur on 23 Jul 2009 08:52

Trackback from fwiskcjg on 23 Jul 2009 09:15

Trackback from jedoifyi on 23 Jul 2009 10:23

Trackback from nnpjqhzb on 23 Jul 2009 10:58

Trackback from urpxurhq on 23 Jul 2009 11:54

Trackback from ijsewbcq on 24 Jul 2009 01:11

Trackback from mexxkijt on 31 Jul 2009 07:15

Trackback from qigyihzt on 06 Aug 2009 01:37

Trackback from Casino 1249772306 on 09 Aug 2009 12:05

Trackback from Casino 1249883930 on 12 Aug 2009 11:16

Trackback from Casino 1250191482 on 14 Aug 2009 06:00

Trackback from Casino 1250533814 on 17 Aug 2009 02:26

Trackback from Casino 1250538984 on 17 Aug 2009 02:53

Trackback from Casino 1250624386 on 18 Aug 2009 02:25

Trackback from Casino 1250625839 on 18 Aug 2009 02:47

Trackback from Casino 1250627697 on 18 Aug 2009 04:38

Trackback from Casino 1250633977 on 18 Aug 2009 05:24

Trackback from Casino 1250699013 on 19 Aug 2009 12:21

Trackback from Casino 1250722054 on 19 Aug 2009 09:04

Trackback from jwgvubpq on 29 Aug 2009 04:07

Trackback from jwgvubpq on 29 Aug 2009 04:07

Trackback from chagfpfa on 12 Feb 2010 10:15

Trackback from download skins for windows media player on 03 Mar 2010 04:33

Trackback from cialis discount on 15 Mar 2010 08:08

Trackback from health benefits of low dose cymbalta on 16 Mar 2010 05:34

Trackback from buying cialis online uk on 16 Mar 2010 05:41

Trackback from cheap cialis on 16 Mar 2010 06:25

Trackback from viagra bestellen online on 16 Mar 2010 06:47

Trackback from cheapest generic cialis in Surry VA 23883 Virginia on 16 Mar 2010 06:52

Trackback from viagra billig bestellen on 16 Mar 2010 07:07

Trackback from cialis online pharmacy 100/100mg pills $1.35 each on 16 Mar 2010 07:33

Trackback from best time to take lexapro 50mg on 16 Mar 2010 07:47

Trackback from swedish to english translation on 19 Mar 2010 07:26

Trackback from plzqfooh on 24 Mar 2010 06:56

Trackback from oajvoyqs on 24 Mar 2010 09:14

Trackback from apcidswg on 24 Mar 2010 09:31

Trackback from qqxseqzr on 26 Mar 2010 09:42

Trackback from kuzyapyp on 27 Mar 2010 12:17

Trackback from wulhzgam on 27 Mar 2010 12:54

Trackback from asnzcawn on 27 Mar 2010 03:07

Trackback from phawtaao on 27 Mar 2010 03:58

Trackback from krlxhmmd on 27 Mar 2010 07:42

Trackback from Casino 1269728909 on 27 Mar 2010 06:55

Trackback from Casino 1269728908 on 27 Mar 2010 06:55

Trackback from Casino 1269729422 on 27 Mar 2010 06:55

Trackback from likxjneq on 27 Mar 2010 08:53

Trackback from Casino 1269771703 on 28 Mar 2010 11:30

Trackback from Casino 1269771815 on 28 Mar 2010 11:30

Trackback from Casino 1269772318 on 28 Mar 2010 11:52

Trackback from wuohmzno on 31 Mar 2010 11:12

Trackback from Casino 1270230446 on 02 Apr 2010 03:51

Trackback from Casino 1270231741 on 02 Apr 2010 03:51

Trackback from Casino 1270232424 on 02 Apr 2010 03:51

Trackback from Casino 1270494559 on 05 Apr 2010 06:20

Trackback from Casino 1270493914 on 05 Apr 2010 08:57

Trackback from aofgypti on 06 Apr 2010 11:20

Trackback from cheap cialis on 16 Apr 2010 03:20

Trackback from faxless easy online payday loans on 16 Apr 2010 03:20

Trackback from buy cipro 250mg in Valley springs SD 57068 South Dakota on 05 May 2010 08:04

Trackback from Casino 1273771865 on 13 May 2010 04:51

Trackback from Casino 1273771396 on 13 May 2010 06:34

Trackback from Casino 1273771956 on 13 May 2010 06:34

Trackback from Casino 1273772417 on 13 May 2010 06:34

Trackback from Casino 1273772500 on 13 May 2010 11:24

Trackback from Casino 1273971839 on 16 May 2010 01:25

Trackback from Casino 1274018354 on 16 May 2010 10:30

Trackback from Casino 1274180235 on 18 May 2010 07:03

Trackback from Casino 1274178521 on 18 May 2010 07:35

Trackback from Casino 1274179362 on 18 May 2010 08:31

Trackback from Casino 1274311448 on 19 May 2010 10:05

Trackback from Casino 1274433794 on 21 May 2010 06:43

Trackback from Casino 1274566454 on 23 May 2010 04:49

Trackback from Casino 1276648322 on 15 Jun 2010 11:23

Trackback from Casino 1276643979 on 15 Jun 2010 11:23

Trackback from Casino 1276644814 on 15 Jun 2010 11:23

Trackback from Casino 1276715057 on 16 Jun 2010 06:08

Trackback from Casino 1276717002 on 17 Jun 2010 12:48

Trackback from Casino 1276953490 on 19 Jun 2010 11:22

Trackback from Casino 1277139884 on 21 Jun 2010 01:07

Trackback from Casino 1277214763 on 22 Jun 2010 10:57

Trackback from Casino 1277306709 on 23 Jun 2010 01:08

Trackback from Casino 1277733784 on 28 Jun 2010 01:43

Trackback from Casino 1280331167 on 28 Jul 2010 02:00

Trackback from Casino 1280345989 on 28 Jul 2010 06:13

Trackback from Casino 1284491528 on 14 Sep 2010 05:15

Trackback from Casino 1287050304 on 14 Oct 2010 07:36

Trackback from Casino 1290150433 on 19 Nov 2010 04:17

Trackback from Casino 1290852380 on 27 Nov 2010 07:30

Trackback from Casino 1292243887 on 13 Dec 2010 10:10

Trackback from Casino 1297161962 on 08 Feb 2011 08:11

Trackback from Casino 1299680089 on 09 Mar 2011 01:23

Trackback from commander viagra on 29 Jan 2012 04:24

Trackback from nymphomax on 04 Feb 2012 04:54

Trackback from mujeres para hacer el amor on 18 Feb 2012 12:49

Trackback from free penis pills on 19 Feb 2012 04:55

Trackback from posters printing on 21 Feb 2012 07:44

Trackback from First Date Guides on 21 Feb 2012 08:24

Trackback from estrogen on 23 Feb 2012 09:12

Trackback from The most successful Is WHAT Website on 26 Feb 2012 07:42

Trackback from receive outlook on 02 Mar 2012 03:30

Trackback from posters printing on 02 Mar 2012 08:38

Trackback from autism treatments on 03 Mar 2012 09:56

Trackback from The friendliest WORKFLOW Website on 04 Mar 2012 05:28

Trackback from auto insurance on 04 Mar 2012 12:41

Trackback from my articles on 06 Mar 2012 06:07

Trackback from bingo cams on 07 Mar 2012 07:40

Trackback from printing posters on 07 Mar 2012 09:20

Trackback from dj table on 08 Mar 2012 12:07

Trackback from lion king broadway tickets on 09 Mar 2012 07:40

Trackback from Zestril side effects, Side Effects of Zestril, Zestril on 09 Mar 2012 10:56

Trackback from legal herb shop on 10 Mar 2012 05:46

Trackback from synchronize on 10 Mar 2012 08:01

Trackback from political postcards printing on 10 Mar 2012 09:28

Trackback from mortgage loans calculator on 17 Mar 2012 06:16

Trackback from Backlink on 19 Mar 2012 03:39

Trackback from revista online on 21 Mar 2012 06:06

Trackback from lion king broadway tickets on 22 Mar 2012 07:44

Trackback from Medigap Insurance on 27 Mar 2012 09:44

Trackback from Online coupon clipping service on 30 Mar 2012 02:29

Trackback from powerful print audit tool on 31 Mar 2012 10:19

Trackback from get car insurance quote online on 06 Apr 2012 05:12

Trackback from popcorn calories on 11 Apr 2012 08:24

Trackback from cheapest car insurance guaranteed on 13 Apr 2012 11:27

Trackback from Online coupon clipping service on 13 Apr 2012 11:29

Trackback from car insurance quotes on 15 Apr 2012 09:18

Trackback from car insurance quotes on 15 Apr 2012 10:47

Trackback from Peliculas Online on 17 Apr 2012 07:13

Trackback from website promotion on 20 Apr 2012 06:43

Trackback from programa de gestion prestashop on 23 Apr 2012 05:15

Trackback from gold forum on 23 Apr 2012 05:40

Trackback from juegos gratis on 24 Apr 2012 03:00

Trackback from canciones online on 24 Apr 2012 10:50

Trackback from learn spanish verbs first on 27 Apr 2012 10:35

Trackback from audio books to learn spanish for children on 27 Apr 2012 03:10

Trackback from canciones online on 30 Apr 2012 01:05

Trackback from jugar gratis on 04 May 2012 04:21

Trackback from direktimport auto on 04 May 2012 02:37

Trackback from hgh benefits on 04 May 2012 11:46

Trackback from short term loan on 06 May 2012 05:15

Trackback from payday advances on 08 May 2012 02:39

Trackback from short term loan on 08 May 2012 01:45

Trackback from buy hgh on 11 May 2012 10:49

Trackback from Custom Facebook Fan Page on 11 May 2012 08:47

Trackback from חשבונית לעוסק פטור on 12 May 2012 08:22

Trackback from read more on 13 May 2012 02:48

Trackback from vitamin a cream for face on 15 May 2012 11:08

Trackback from cancionesonline.net on 16 May 2012 02:46

Trackback from bridging finance on 16 May 2012 08:43

Comments

Saturday, 14 Feb 2009 07:29 by Jeremy Thake
That's a great list of pros and cons! I've been encouraging people to contribute to the SharePointDevWiki.com page with pros and cons too. Be great to get your pros/cons consolidated on this wiki page! http://www.sharepointdevwiki.com/display/public/InfoPath+Forms+vs+ASP.NET+Forms Thanks Jeremy Thake
Friday, 20 Feb 2009 02:25 by James
Fabulous and great article in comparing the two different approaches, I had had a big headache when I was developing a complex InfoPath form which required data integration with SAP. Although it's a past right now, I would really choose ASP.NET at the first place.


Name

Url

Email

Comments

CAPTCHA Image Validation