As a developer I often use components and solutions built by someone else. This is often hard to do or time-consuming because you need to learn how to use the component for what you need. Sometimes you need to alter business workflow in order to fit it into the components you can build into the application.
Those cases occur often when you need to build web site with views and functions that are not provided by content management systems. It is more complicated when the client decides to use the CMS as a back office application and to keep there some business information like storage place holders, accounting and delivery orders.
This is a guide for how to make a fast web-based business solution for a small company – allowing them to have a web site with sort of CMS and a back office application with all the business functions they need.
The scenario I’m working on is an Insurance company started 10 years ago as one men re-selling insurances and now he owns a number of offices and he has employees to sell insurance cards for him.
Because LightSwitch solution is less flexible on configuration I will start with it. Under Windows 8 Release Preview I created the project and the database. This project has what I need for the back office application. It shall include all business functions and workflows. All screens with lists and views organised for different roles.
Friendly note: When you prepare the publishing package don’t forget to remove the check box in front of “IIS Server has the LightSwitch Deployment Prerequisites installed”. This tool me hours to solve.
For publishing this you need a Server with Web Deployment capabilityes even if you copy the package over and import it into IIS.
The next step is to bring the ASP.NET application to work with the same database.
I created a .NET framework 4 ASP.NET Web Form application. By default those templates are using Role and Membership Providers, but they are the ASP.NET Universal Providers: System.Web.Providers.DefaultProfileProvider and System.Web.Providers.DefaultMembershipProvider.
LightSwitch is using System.Web.Security.SqlRoleProvider and System.Web.Security.SqlMembershipProvider. The difference is that SqlMembershipProvider\SqlRoleProvider only works with MS SQL Server and MS SQL Server Express.
Changing those by simply copy over the membership, role and profile settings from web.config after installing the LightSwitch in IIS will bring a small issue.
The two application may eventually work with different HASH algorithm for password encryption.
<membership defaultProvider="AspNetMembershipProvider" hashAlgorithmType="SHA1"> <providers> <clear/> <add name="AspNetMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="DefaultConnection" applicationName="InsuranceApp" requiresUniqueEmail="false" requiresQuestionAndAnswer="false" passwordCompatMode="Framework40"/> </providers> </membership>
The key here is in passwordCompatMode=”Framework40″ and hashAlgorithmType=”SHA1″.
Friendly note: According to the documentation the string value of the hashAlgorithmType attribute can be any of the provided .Net hashing algorithm types. A bit of digging shows that the valid values for ASP.Net 2, 3 and 3.5 are MD5, RIPEMD160, SHA1, SHA256, SHA384, SHA512. The important part here is that all these classes inherit from HashAlgorithm.
If you are working with IIS 7 you can update this using the “Machine Key” configuration. This allows you to choose the encryption method from a list of available options and specify the keys or the key generation options.
Now … this is where I wrote this post.
And all this in 8 hours including publishing.
(excluding website design and logos – those were ready from before I started)