29 May 2007

How To Make Your Own Web Installer Part II - Set Up Structure of Jumptree Project ASP.NET Installer

It has been awhile and as I mentioned previously , I've seen several people searched “web installer” from search engines and stumble crossed my web site. Unfortunately, I never went into details of how a web installer works, I sincerely hope those who left found their solution eventually.

When we started Jumptree Project Management, one of the core requirements is to simplify the process of installing a web application and after much research and experiments, we think we've came up with a rather satisfying solution and here I want to share with everyone what we did.

First thing that comes to mind is a installer is a multi-stepped process, right off the bat, the question is do you divide up all the steps into separate pages or do you do everything in one single page?

My decision was s single page because this way, I don’t’ have to pass parameters back and forth, in addition, view state provided by ASP.NET will ease a lot work that I have to do. For this purpose, the “MultiView” ASP.NET web control firsts this purpose perfectly.

Now, in our installer, we had 8 steps, but because we had the business requirement to setup a default user once the installer is complete and emails the customer of the default user information. For simplicity’s sake, we’ll skip these steps and show only the necessary parts of the installer, such 6 steps and let’s break it down.

1.      Welcome page – welcome the customer and describe your software requirement

2.      License Agreement – show the customers your license information and they must agree in order to process

3.      Database Access – this part is the meat of the installer, identify the database server which your application will install to.

4.      Select Database – allow the customers to choose from a list of databases available to their user id.

5.      Confirmation – List all the information the customer entered and allows the opportunity to edit them if they want to. This serves as the last step before installer goes to work!

6.      Final Page – This gives your customer a final confirmation on the result of your installer. If successful or if not successful.

Before we get to coding, let's review the screen shots



  

Okay, so we got the basic workflow out of the way, let’s start some basic coding.

Multiview is perfect for switching back and forth between different views, so let’s set up the structure like so

<asp:MultiView ID="SetUpInstaller" ActiveViewIndex="0" runat="server">

<asp:View ID="Welcome" runat="server">

<
asp:Button ID="ContineueToLicenseButton_FromWelcome
CommandName="ToLicenseAgreement"
OnCommand="InstallerNavigation"
runat="server"                                                               
Text="Next &raquo;"
/>

</asp:View>

<asp:View ID="LicenseAgreement" runat="server">

<asp:Button ID="BackToWelcomeButton_FromLiceseAgreement"
CommandName="ToWelcome"
OnCommand="InstallerNavigation"
runat="server"
Text="&laquo; Previous"
/>

<asp:Button ID="ToDBSetup_FromLicenseAgreement"
CommandName="ToDBSetup_FromLicenseAgreement"
OnCommand="InstallerNavigation"
runat="server"
Text="Next &raquo;"

/>

</asp:View>
<
asp:View ID="DataBaseLogin" runat="server">

<asp:Button ID="BackToLiceseAgreemen_FromDBSetup"
CommandName="BackToLiceseAgreemen_FromDBSetup"
OnCommand
="InstallerNavigation"
runat="server"
Text="&laquo; Previous"                                       

/>

<asp:Button ID="ChooseDB_FromDBSetup"
CommandName="ToChooseDB_ FromDBSetup"
OnCommand="InstallerNavigation"
runat
="server"
Text
="Connect and Choose a DB"/>

<asp:Button ID="ToConfirmation_FromDBSetup"
Visible
="false"
CommandName
="ToConfirmation_FromDBSetup"
OnCommand="InstallerNavigation"
runat
="server"
Text="Next &raquo;"

/>

</asp:View>

<asp:View ID="Confirm" runat="Server">

<asp:Button ID="BackToDBSetup_FromConfirmation"
CommandName
="BackToDBSetup_FromConfirmation"
OnCommand="InstallerNavigation"
runat="server"
Text="&laquo; Previous"
/>

<asp:Button ID="ToComplete_FromConfirmation"
CommandName="ToComplete"
OnCommand
="InstallerNavigation"

runat
="server"
Text="Install"

/>


      </
asp:View>

<asp:View ID="Complete" runat="server">
</asp:View>

</asp:MultiView>


As you can see, each step is a "View" and inside each view, I added the "Back" and "Next" button. They are hooked into the MutltiView function "InstallerNavigation" via OnCommand="InstallerNavigation" and each button has a specific CommandName uniquely identified by via the name in their current step.

I used the naming convention "To...From.." and "BackTo...From..", this will help clarify any confusion when we get to the coding.

I'm a bit tired from actually writing the article such far, so let me stop here and I will continue the installer in the next article. The plan is to actually get to the coding in the background, how we proceed to each step and possibly get to how we connect to database,  select the database we need and execute .sql scripts that we exported from sql server.

Food for thoughts that I think you should think about before my next article

The issue of a web installer are the following

  • How to exectute .sql script files exported via sql server
  • How to grant permissions so the user has execute rights to the tables/store procedurs in the .sql script file
  • Where to place the .sql script file so it's not accessible by typing directly in url.
  • How to save the configuration settings to ASP.NET's default configuration file, namely "web.config" without rebooting the application (everytime the web.config is changed, application will be rebooted, it'll affect the installer in th mids of installation)
  • On a related note, write permission is needed to modify files, how do you detect if the user has write permission?
  • How to disable the installer once it's completed such outside users can't access it freely.
  • Lastly, "Medium-Trust" is a requirement as a lot people are in a shared host environment, what needs to be avoided?

Think about them and when I get to my next article in the series, you will see how we resolved each issue.

Stay tuned.



 
Anonymous comments are disabled