User Tools

Site Tools


Software integration for ASP.NET

In this guide we will apply the logic used for encoding incoming SMS with XML to the integration of an ASP.NET software with our FoxBox.

:id1: Remember to activate the XML module by removing the sharp character (i.e. ”#”) from the internal Eventhandler, near the call to the sms2xml script. Once done this, each time you will receive an SMS it will be stored inside of the file sms.xml.

As an example, we are going to create a simple Web page that loads data from the XML file sms.xml, showing them in a DataList element. For this implementation we used Microsoft™ Visual Web Developer, a really interesting tool that provides a simple way for ASP.NET development.

The VWD environment provides a really good support to XML but, as many other programs, it takes informations from node attributes instead of their content. To override this issue, we provide a simple script that exports informations in the correct XML format:

Run this script only when a message was received.
if [ "$1" != "RECEIVED" ]; then exit; fi;
#Extract data from the SMS file
FROM=`/etc/procmail/formail -zx From: < $2`
TEXT=`/etc/procmail/formail -I "" <$2 | sed -e"1d"`
#Save as XML
#for some reason the mktemp-command creates two instances of the file if I 
#add the .xml-extension to the FILENAME-variable.
FILENAME=`mktemp /mnt/flash/root/xml/smsXXXXXX`
echo "" >$FILENAME.xml
echo "" >>$FILENAME.xml
echo "  " >>$FILENAME.xml
echo "" >>$FILENAME.xml
#Delete the original file without the .xml-extension

As you can see, all the informations are now assigned to the relative attribute in the tag, so that you can simply link a datasource to the file inside of your ASP.NET project.

asp.net_intergration.txt · Last modified: 2016/06/14 18:35 (external edit)