Mobile Experiments with MS-ASP.Net

I have for some time been using and teaching Microsoft ASP.Net. ASP.Net is a product created by Microsoft to support client and server side web programming on its IIS Internet Servers. Even though Microsoft does sell tools to program in this environment, you can use it entirely for free. You will need a hosting service that supports ASP.Net (IIS server support) to store your pages but there are many very reasonable hosting services available (I use GoDaddy.com). ASP.Net started out as just ASP (Active Server Pages) and has undergone many changes over the years (including the addition of .net to its name). This is not the blog for that so I would suggest you visit one of the many web sites dedicated to ASP.Net. You will find info on its history, future direction and free training options.

How do know if you have used ASP.Net?

ASP.Net pages have a file extension of .aspx. If you look for them you will see them while surfing (just keep an eye on the address box in your browser). If view page source on an aspx file, you will see some html, some asp tags and maybe some JavaScript (ASP.Net can accommodate client side JavaScript but scripting languages are not supported by all mobile browsers yet so we will avoid it for mobile pages).

ASP.Net works by letting you combine html, asp graphical controls with the Visual Basic or C# programming languages to create rich web pages. The programming languages make this a very robust solution and the beauty of this is that the programming takes place on the server which sends the client device just html (note: there are some exceptions to this so like html only web pages, you have to be careful what you use in your page if you expect it to work on a mobile device). Whereas scripting is usually avoided for mobile apps and can be embraced with ASP.Net since the scripting takes place far away from the client browser (on the Internet Server).

So what’s the big deal?

The benefit of this way of creating web content is that many of the limitations placed on mobile devices (scripting first and foremost) can be overcome by doing the programming on a server and having the server send just html to the mobile client. I have for some time wanted to create assessment pages for a mobile device (i.e. a quiz or a test). With ASP.Net, I can use html to create the questions and use the server programming to evaluate the answers and score the assessment. This is demonstrated in a page I created to illustrate a simple quiz Click Here.

The ASP.Net code used for this application consists of two files. One file describes the page (questions and answers selected with radio buttons) in a combination of html and asp elements. You easily see both in this file snippet (click here for full aspx file).

<%@Page Language=”VB” AutoEventWireup=”false” CodeFile=”Default.aspx.vb” inherits=”_Default”%>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<htmlxmlns=”http://www.w3.org/1999/xhtml”>

<head runat=”server”><title></title><style type=”text/css“>


.style1

{

font-family: Calibri;

color: #333399;

font-weight: bold;

font-size: xx-large;

}


.style5

{

font-size: xx-large;

font-weight: bold;

color: #333399;

}


.style6

{

font-family: Calibri;

color: #000000;

font-weight: bold;

font-size: xx-large;

}


</style>

<link href=”StyleSheet.css rel=”stylesheet type=”text/css
/>

</head>

<body>

<form id=”form1″ runat=”server”>

<div >

<span class=”style6″>ASP.Net</span><span class=”style1″> Assessment Test Experiment </span>

<br class=”style5″
/>

<span class=”style1″>mobiledot.mobi<asp:Label ID=”errLabel runat=”server” Text=”"></asp:Label>

</span>

<br/>

<br/>

</div>

<! Question 1 –>

<div class=”questoddStyle >

….

</form>

</body>

</html>


Behind this ASP.Net page (the user interface page that has the definition of the screen has an extension .aspx. The programming file behind it has a file extension of .aspx.vb) are programming statements which read the input and process it against code that will provide a new feedback page viewable on a mobile (or PC) browser. That programming code looks like this. I don’t believe is very complicated for anyone who has written a macro program before. This example is written in Visual Basic.

Partial Class _Default

Inherits System.Web.UI.Page

Private intScore As Integer

Protected Sub Page_Load(ByVal sender As
Object, ByVal e As System.EventArgs) Handles Me.Load

Application(“hit_counter”) += 1

hitCount.Text = Application(“hit_counter”)

authorproduct.Text = Session(“author”) & ” | “ & Session(“product”)

End Sub

Protected Sub btnSubmitt_Click(ByVal sender As
Object, ByVal e As System.EventArgs) Handles btnSubmitt.Click

If RadioButtonList1.SelectedItem.Value = “Blue” Then

intScore += 1

RadioButtonList1.BackColor = Drawing.Color.DarkGreen

RadioButtonList1.ForeColor = Drawing.Color.AntiqueWhite

Else

RadioButtonList1.BackColor = Drawing.Color.DarkRed

RadioButtonList1.ForeColor = Drawing.Color.AntiqueWhite

End If

If RadioButtonList2.SelectedItem.Value = “Dr Zhivago” Then

intScore += 1

RadioButtonList2.BackColor = Drawing.Color.DarkGreen

RadioButtonList2.ForeColor = Drawing.Color.AntiqueWhite

Else

RadioButtonList2.BackColor = Drawing.Color.DarkRed

RadioButtonList2.ForeColor = Drawing.Color.AntiqueWhite

End If


If RadioButtonList3.SelectedItem.Value = “Kite Runner” Then

intScore += 1

RadioButtonList3.BackColor = Drawing.Color.DarkGreen

RadioButtonList3.ForeColor = Drawing.Color.AntiqueWhite

Else

RadioButtonList3.BackColor = Drawing.Color.DarkRed

RadioButtonList3.ForeColor = Drawing.Color.AntiqueWhite

End If

If RadioButtonList4.SelectedItem.Value = “VB.Net” Then

intScore += 1

RadioButtonList4.BackColor = Drawing.Color.DarkGreen

RadioButtonList4.ForeColor = Drawing.Color.AntiqueWhite

Else

RadioButtonList4.BackColor = Drawing.Color.DarkRed

RadioButtonList4.ForeColor = Drawing.Color.AntiqueWhite

End If

If RadioButtonList5.SelectedItem.Value = mobiledot.net” Then

intScore += 1

RadioButtonList5.BackColor = Drawing.Color.DarkGreen

RadioButtonList5.ForeColor = Drawing.Color.AntiqueWhite

Else

RadioButtonList5.BackColor = Drawing.Color.DarkRed

RadioButtonList5.ForeColor = Drawing.Color.AntiqueWhite

End If

lblScore.Text = “Correct right was “ & intScore.ToString & ” out of 5.”

End Sub

End Class

The Experiment continues…

I am working to exploit the programming friendly environment ASP.Net affords mobile computing and hope to add an easy to use assessment component to MLEX. I also have plans to convert MLEX to an Internet application via ASP.Net. I think is a better way to deploy the program and will remove the requiement to run on MS-Windows (Even though ASP.Net is a MS product, it creates web pages which are displayable on any browser regardless of the operating system).

Summer Break (taking a little break…)

I have been very busy since starting my sabbatical in the Fall and teaching again in the Spring and over the summer. I am going to suspend my blog posting until September at a point in time that I hope to have more done on the web version of MLEX.

Posted on June 19, 2009 at 2:23 pm by admin · Permalink
In: Techie Stuff

One Response

Subscribe to comments via RSS

  1. Written by Vanessa Bennett
    on May 27, 2010 at 5:41 pm
    Reply · Permalink

    Mobile computing is on the rise these days. Maybe we will get a dual core powered cellphones in the future.:;,

Subscribe to comments via RSS

Leave a Reply