TR0739
TR0739
Author:
Magnus Holmberg
[email protected]
Supervisor/Examiner:
Frank Lüders
[email protected]
The demand of dynamic web pages has increased the latest year and this has resulted in a
higher demand on the developing platform and the developer. In this thesis a comparison
between Microsoft Visual Studio with ASP.NET and Netbeans IDE 6.0 using JSP tech-
nology will be done. First a website will be developed with both platforms according to
a specified website. When developing the specified website only built in components and
functions will be used except the code behind that can be written in any way using any
language that the platform supports. The two different platforms will be compared against
each other according to predefined comparison scenarios. The comparison scenarios will
hopefully show some difference between the two platforms and by the difference found this
will show which platform that is preferable. The scenarios that will be looked into are
three different categories such as design, development and manageability.
Sammanfattning
Efterfrågan på dynamiska hemsidor har ökat markant det senaste året and detta har
resulterat i högre krav på både hemside utvecklaren och utvecklings plattformerna. I denna
avhandling kommer det att göras en jämförelse mellan Microsoft Visual Studio ASP.NET
och Sun Microsystems Netbeans IDE 6.0 som använder sig av JSP teknologin. Först
så kommer en hemsida att utvecklas i de båda plattformerna enligt en specifikation. När
hemsidan utvecklas kommer endast att inbyggda komponenter och funktioner att användas
förutom koden som ska skrivas bakom ASP och JSP där språket som stödjs av plattfor-
men får användas. The två olika plattformerna kommer att jämföras mot varandra enligt
fördefinierade jämförelse scenarion. De olika jämförelse scenarierna kommer förhoppn-
ingsvis att påvisa skillnader mellan de två plattformerna och dessa skillnader kommer att
visa vilken plattform som är bäst. Jämförelse scenarierna kommer att göras i tre kategorier
såsom design, utveckling och uppdaterings förmåga.
Contents
1 Introduction 5
2
4.4.3 Create Object Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.4.4 Login Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.4.5 Show Objects Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.4.6 Object Information Page . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.7 Show Pictures Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.8 Crypt Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.9 Save Picture Class . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.5 Netbeans Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.5.1 Beginning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5.2 Navigation Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5.3 Create User Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5.4 Create Object Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5.5 Login Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.5.6 Show Objects Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.5.7 Object Information Page . . . . . . . . . . . . . . . . . . . . . . . . 35
4.5.8 Show Pictures Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3
List of Figures
2.1 Standard Html sends a request to the server which retrievs a file and sends
it back to the client. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Sends a request to the server which retrievs a file, processes it if needed and
then returns the output html code. . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Example of embedded video on YouTube . . . . . . . . . . . . . . . . . . . 9
2.4 Internet Information Service Manager . . . . . . . . . . . . . . . . . . . . . 11
3.1 Netbeans IDE 6.0 shows the IDEs. Editor, GUI, other visual tools etc. . . 17
4
Chapter 1
Introduction
The first webpage began at CERN (Centre Européen de Recherche Nucléaire) where they
researched in how to share documents using a web browser [4]. This was the start of the
World Wide Web as we know it today. First web pages could only show static information
but later the CGI (Common gateway interface) was developed which made it possible
for an application to communicate with a server passing requests to it. This made it
possible to developing dynamic web pages with interactivity for the user. There are many
different sorts of developing environments and templates with which it is possible to create
a dynamic web page. Active Server Pages (ASP), Java Server Pages (JSP) and PHP:
Hypertext Preprocessor (PHP) are some of the most common script engines but which
one should a developer choose? This thesis will focus on comparing Microsoft ASP.NET
and Sun Microsystems Netbeans IDE. Working with a project using some kind of method
will help you to solve some problems and it also makes it easier to know what to do in a
more structural way. The method does not help with specific details but it helps setting
up goals and guidelines. There are different methodologies for different kind of projects
and for this project the case study method is preferred [1]. In a case study the project is
first presented and the goal for the project will be decided. The goal and the specifikation
will be described in the report.
5
Chapter 2
2.1.3 Security
There are several ways in that the .NET Framworks protects the code and its resources
from unauthorised access. ASP.NET provides a way to use authorized roles or authorize
HTTP verbs stored in a XML file list or the file system, this to limit the access to a web site
by comparing the authenticated credentials. .NET also has a security mechanism called
Code Access Security (CAS) which uses permissions to limit the access to protect resources
and operations. To help the developers to protect the data and communication between
servers .NET offers Cryptographic services. The Cryphtographic service provides methods
to encrypt, decrypt and to secure the channels of communication. .Net have many features,
tips and tricks regarding the security, more can be read at [23, 24].
6
Figure 2.1: Standard Html sends a request to the server which retrievs a file and sends it
back to the client.
ASP releases:
7
Figure 2.2: Sends a request to the server which retrievs a file, processes it if needed and
then returns the output html code.
When Microsoft introduced ASP.NET in 2002 some major changes were made. Two of
the changes were: ASP.NET comes with the ability of multi-language as the .NET Common
Language Runtime (CLR) which allows web pages to be written in Csharp, jsharp and VB.
ASP.NET offers the ability of using predefined controls such as buttons, labels, etc. The
developer can choose to cache just parts of the page to improve the performance.
8
Figure 2.3: Example of embedded video on YouTube
the COM technology is language neutral so that it is possible use and reuse them in differ-
ent environments and the components can even be used across machines of different types
and different operating systems.
2.3.1 Security
The Internet Information Services web servers have been having some concerns about their
security [11, 12, 13, 14, 2]. They have encountered issues since the release as a part of
Windows NT. In the release of IIS 6.0 some security vulnerabilities have been patched and
now in IIS 7.0 version so far no security vulnerabilities have been detected. One security
breech came from the infamous Code Red Worm were the worm found a vulnerability in
9
the indexing software distributed with IIS. The worm used a common vulnerability called
"buffer overflow" which basically is when a buffer overflows. This specific worm used a
long string of repeating the character ’N’ to overflow the buffer. This kind of vulnerability
lets the intruder to run arbitrary code on the targeted machine.
Regarding the security IIS version 5.0 and higher supports some authentication mecha-
nisms:
Basic access authentication: This authentication is a method that lets the application
to pass information about user name and password but it have to relie on that the connec-
tion between client and the server is secure.
Digest access authentication: Basically encrypts the user identity so that it is more
secure to send the identity over a connection instead of sending it as plain text. Helps
basic access authentication not to send unencrypted information.
Integrated Windows authentication (IWA): It first tries to use the current Windows
user information on the client before it asks for user information. The Integrated Windows
authentication hashes the information before it sends information over the web. The client
browser proves its identity through a cryptographic exchange with the web server. IWA
uses the protocols SPNEGO, Kerberos and NTLMSSP.
.NET passport authentication: This is a authentication that lets the user use the
same login with different websites. The information is sent through a Secure Socket Layer
(SSL) to a Windows authentication server which in return checks if the user has a valid
GLOBALAUTH-cookie then the user receives an ID-tag encrypted with triple DES stan-
dard. The authentication server then communicates with the targeted website letting it
know of the agreed ID-tag. .NET passport is used by many popular web sites and pro-
gram such as Windows Live messenger, Hotmail and more. .NET passport also known as
Window live id is plattform-neutral and have support in Perl, PHP, Ruby, Python etc.
2.3.2 Reliability
As of Internet Information Services version 6.0 servers a single web application no longer
can cause other web applications and web sites to fail. The system is built in such way that
web sites on same server is isolated from each other into self-contained. The processes on
the server operates independently in so called worker processes so if one process fail is does
not affect the other processes. This will make the system more fault-tolerant, makes the
web sites more available and increases the number of web sites that a server can host. It is
possible to monitoring these worker processes by letting them get pinged this will help the
system to detect failures. In this way IIS 6.0 will now if something have gone wrong and
can then restart the failing application. Incoming requests to the failing application will be
queued and sent to the application when it is possible. In a IIS 6.0 server the administrator
can limit the CPU to different applications or web sites. This can be set to a predetermined
period of time so that CPU time not is wasted in low activity or low priority processes.
These are some of the features that will make the server help the applications and web
sites to increase the availability, manageability, reliability and decrease the downtime.
10
Figure 2.4: Internet Information Service Manager
2.3.3 Manageability
Internet Information Services 6.0 uses an Extensible Markup Language (XML) to store
the Web Server configuration data. Editing the XML sheet can be done using a text
editor which will make it much easier for the administrator to understand. With IIS 6.0
the administrator can use a third party monitoring and management tool to access the
configuration data which will lead to better tool integration. Managing IIS 6.0 server
configuration can be done while the server is running. When saving the configuration
a copy of the old configuration is saved with a unique version number and then new
configuration is marked as the new "metabase.xml". This will make it easy to rollback
configurations. If the new configuration makes the system to fail, IIS 6.0 will automatically
rollback to the previous configuration XML, this to prevent the Meta database to crash
the system over and over again. The configuration XML sheet can easily be exported
and imported to different servers. Backing up the system can be made so that it can
be restored on a different server (server-independent-backup). Managing the IIS 6.0 the
administrator can use IIS Manager which is a graphical user friendly interface with full
access to the web server. With IIS Manager the administrator can access the web server
from a remote computer. IIS 6.0 supports File Transfer Protocol (FTP) to transfer files
and uploading web content. When uploading files it is possible to restrict users to specific
directories, for example the administrator can restrict the users only to have access to
their own directory which will prevent them to overwrite other user’s web content. IIS 6.0
also supports Simple Mail Transfer Protocol (SMTP) that can be used for sending e-mail
messages between servers. This is some of the features in IIS 6.0 that helps administrators
to mange their server easier.
11
2.3.4 Scalability
Security
When running multiple web sites or applications on a single server some security require-
ments are needed. IIS 6.0 separates and isolates the application pools that mange the web
sites and applications. Running a server with files with dynamic extensions such as com-
piling and executing the administrator must add these file extensions to the Web service
extension list. This will prevent dynamic extensions that not are permitted on the server.
Calling dynamic extensions that not are permitted will result in a error message with lim-
ited information which will prevent hackers potential hackers. IIS 6.0 is protected from the
most common attacks to Web servers two of these are buffer and memory overflow. The
system is configured to handle data transmissions of unknown size. This is done with a
memory-overflow protection. When a buffer or memory is over flown the affected worker
process will be shut down preventing it from interfere other processes. This protection
would have protected IIS against the infamous Red Worm which attacked IIS versions
4.0 and 5.0. User accounts in IIS 6.0 are set to lowest privilege needed for any operation.
Worker processes are running under Networkservice accounts which are limiting the system
privilege. This will lower the chances of exploiting security vulnerabilities. IIS 6.0 have
full support for Secure Socket Layer (SSL) and Transport Security Layer (TSL) exchang-
ing information between clients and servers. The administrator have full access choosing
cryptography service, it is even possible to use hardware accelerator cards. Administrators
can limit which TCP/IP and UDP ports that is open. This will prevent attacks against
ports opened unintentional. The amount of aloud data can be limited. IIS 6.0 have got
some authentication support see IIS security.
Performance
The scaling in IIS 6.0 i greatly improved so that it can host many sites at the same time.
IIS 6.0 has many options were the administrator can tune the server soo that unsatisfied
performance can be avoid. Like bottlenecks, bad response and other errors. Scaling is to
balance the system to increase the demand at an aceptable level of perfomance. When IIS
6.0 gets a peak in traffic the system then can be tuned to scale. The system is scalable in
many different aspects. Some of the aspects is shortly discribed below:
• IIS 6.0 includes scalability through Network Load balancing between servers, with
only one server it is only possible to provide a limited level of server reliability therefor
it is vice to combine the resources of more than one computer.
• To large queues is an unwanted behavior in a server that is why IIS 6.0 provides
the ability to optimize the queues, the dministrator can set theese request queues:
TCP/IP queue, ASP request queue, kernale request queue and ASP.NET request
queue.
12
• Caches is used to store requested data. Without caches or caching it can be very
timeconsuming. IIS uses caches which are enabled by default and do not commonly
need any tuning. But if it is nessesary the cahces can be adjusted.
• IIS supports three different common Internet service providers (ISP) installation
strategies which can be used when IIS running in worker process isolation mode.
The three modes are:Shared static hosting, Shared static and dynamic hosting and
Dedicated hosting.
13
Chapter 3
3.1 Java
3.1.1 History
The Java history started in 1991 when James Gosling made up his mind to implement
a virtual machine and language that had familiar notation as the C/C++ family [18,
19]. First release of Java 1.0 was in 1995 and Gosling promised "Written Once, Run
Anywhere"(WORA). Web browsers started to use secure Java applets in their web pages
and Java became very popular. To formalize Java Sun Microsystems approached the
ISO/IEC JTC1 and ECMA international standards this was done in 1997. As of 8 May
2007 Sun is done making the entire Java core code into open source.
14
Java Servlet
The Java servlet is similar to the non-Java technologies supporting dynamically web con-
tents such as PHP and ASP.NET. The servlet can be thought of as an applet on the server
side [20]. Servlets makes it possible to maintain state through cookies and sessions or
URL rewriting. The servlet is an object that receives a request and then delivers a re-
sponse. To deliver the response the servlet goes through some translation and compiling
in the server. The servlet API defines the different interactions of the Web container and
a servlet. The web container is responsible to manage the life cycle, mapping a URL and
that the requester has the correct access rights for a specific servlet.
15
3.2.1 Java Platform Enterprise Edition (Java EE)
Java plattform Enterprise Edition (Java EE) is a platform for developing robust, portable,
scalable and secure serverside Java applications [20, 21]. The Java EE applications pro-
vides functionality to deploy fault-tolerant, distributed, multi-tier Java software based on
components that is deployed on application servers that can be accessed through a web
browser. Java EE provides the developer with a framework for developing and deploying
web services on the java platform. For faster solutions and to simplify the development
Java EE uses "containers". One of theese containers is the Enterpris JavaBeans (EJB)
which provides the developer with features as scaling, threading, transaction management
etc. Java EE allows freedom of choice beacause the Java EE technology use standards that
many vendors can implement. To ensure compability among the applications Java EE sup-
plies a Compability Test Suite (CTS) which makes the portability of the components and
applications written for the Java platform by the vendors much easier. Java EE simplifies
the connectivity for already existing applications and systems that can be used on the web
or in other devices.
3.3.1 Security
Security within the server is about protecting data by preventing unauthorized access and
damage to it. The security is based on the Java 2 Enterprise Edition (J2EE) standards.
The J2EE standard includes some built in security as cryptography, authentication and
16
Figure 3.1: Netbeans IDE 6.0 shows the IDEs. Editor, GUI, other visual tools etc.
authorization, and public key infrastructures. The Application server support both SSL
3.0 (Secure Socket Layer) and Transport Layer Security (TLS) 1.0 encryption protocols.
The server provides with a tool to configure the security. With this tool the security of
the entire server can be configure as to manage users, groups, and realms, and to perform
other system-wide security tasks [27, 28, 29].
17
Java Standard Edition (Java SE)
As described in Java EE authorization is needed to have control over the protected re-
sources. This makes the use of authentication and identification crucial when protecting
the data from unauthorised users. Java SE provides support of security mechanisms. Some
of the implementation mechanisms are described below [28].
• Java Generic Security Services (Java GSS-API): This security service provides
a secure way to exchange messages between communicating applications.
18
Chapter 4
4.1 Methodology
Working with a project with some kind of method will help you to solve some problems
it also makes it easier to know what to do in a more structural way. The method does
not help with specific details but it helps setting up goals and guidelines. There are
different methodologies for different kind of projects and for this project the case study
method is preferred [1]. In a case study the case is first presented and the goal for the
project will be decided. In our case a website will be presented below and the goal is to
implement it in the easiest way with the components, methods etc. that the Web Platforms
provide. The implementation and design should be structured. The design in a case study
may be flexible, it is ok to change the question at issue and slightly change the direction
within the study. This suites this project well because within the study problems and
new questions can be found when implementing the website therefore some changes can
be necessary under the developing of the website. In a case study the primary data should
be qualitative and as in this project the data endures of the implementations made in the
two Web Platforms. This data will be the qualitative data that will be evaluated and
compared. The evaluations and conclusions that will be drawn are my own opinions and
will be as fairly judged as possible.
To study these two different Web Platforms that should be compared and evaluated it is
wise as said above to specify the website before starting to implement it. In this project
a dynamic homepage will be implemented and out of this hopefully some results and
conclusions can be drawn.
4.2 Goals
In this project there will be a comparison between two web platforms that uses different
technologies and programming languages. One of the platforms uses JSP (Java Server
19
Figure 4.1: Prototype of the Welcome page
Pages) with java technology and the other platform uses ASP (Active Server Pages). These
two platforms will be used to implement a dynamic website as the specification seen 4.3.
The areas that will be tested are design, development/implementation and manageability.
To test these area some test scenarios have be made and can be seen in section 5.1. The
goal is to be able to compare these two platform, draw some conclusion and perhaps show
if there is some of the platforms that is preferable.
20
Figure 4.2: Prototype of account creation page
figure 4.3. On the create object page the customer should be given the opportunity to add
some picture of the object if it is desired. To view the objects on the website simply press
the link to show objects from the menu on the left side. On this page the customer should
be presented with for example a table with the objects that exists on the website as seen
in figure 4.4. From this page the customer should be able to choose one of the objects to
get more information about the chosen object. On the page that shows the chosen object
the information should be presented in a way that it is easy to read the information. On
the page the customer should be able to press a button or something to be redirected to
a page that shows the pictures of the object. The website also got a login page. On this
page the customer can login which is necessary for getting access to the object creation
page. The idea of having the login page is to test if the web platform has some built in or
some other way any implementation to encrypt a password. The website should contain a
database where all the information from the customer, object and the pictures belonging to
the objects should be saved. The design and relations of the database is describe with an
ER (Entity-Relationship) model shown in figure 4.5. Which database that should be used
in the different Web Platforms will be chosen when implementing. A good choice would
be to pick a database that is produced by the same manufacture as the Web Platform
this should give the best performance because the manufacture hopefully have made it in
every way compatible and taken in consideration to have the best performance for its own
development program. The website will be implemented by the two web platforms on the
same computer. The system specifiaction of the computer is: AMD Turion 64bits 1.8GHz
processor with one gigabyte DDR ram memory running on Windows XP Home edition.
21
Figure 4.3: Prototype of create object page.
22
Figure 4.5: Entity-Relationship Model
23
4.4 Visual Studio Implementation
Before starting implementing in Visual Studio I first had to install the program. Installing
Visual Studio 2005 was very easy and no problem was encountered. After installing the
program some new updates was automatically installed. At the first glance of Visual Stu-
dio it looks very professional with a good design and menus easy to understand and read.
I have had no previous experiences with Visual Studio 2005 Asp.net website development
so I started to search information on the web. Searching Google I found MSDN (Microsoft
Development Network) and ASP.NET websites which had a lot of information about de-
veloping in Asp.net Visual Studio. At the Asp.net there are many tutorials for beginners
and more advanced developers. The tutorials can be watched as videos where a Microsoft
developer tries to learn how to develop in Visual Studio and there is also possible to view
the source code from tutorials. After watching some videos and going through tutorials I
was ready to start my website project in Visual Studio. The GUI(Graphical User Interface)
of Visual Studio as can be seen in figure 4.6. On the left hand there is a Toolbox which
holds all the .net components that the developer can use in the design mode. If there is
something the developer would like to use it is only to drag and drop it on the design surface
and then the developer can use the component for example a button to click on. On the
design surface the developer can for example change the size and position of the button.
Highlighting a component on the design layout properties of the component can be seen
in the properties tab to the right see figure 4.6. In the properties tab the developer can
see and change some information, the properties are: ID, back color, css class, font, font
color etc. The ID is the name of component which the developer uses when writing source
code. Also on the right side in Visual Studio there is a solution explorer which shows your
project with the files associated to it. Here you can alter the associated files, for example
add data files etc. Above the solution explorer there is a Server Explorer which contains
information about your servers and data connections. In this tab you can find information
about your database if you have one. The information that can be seen in the database is
the tables, stored procedures etc. On the bottom of the window an output and an error
list is presented, here is the information about your project is presented for example when
the project is built and some error have been found when debugging it. All these different
tools and tabs can be chosen to be shown or not by the programme. There is also a lot of
other different that can come in handy. Now I was well known with or rather I had an idea
about how the Visual Studio layout was working and if I were to encounter some problem
I knew that more information could be found [25, 26].
24
Figure 4.6: Visual Studio 2005
25
Figure 4.7: GUI of database tables creation
26
all the time. The layout I fixed with a table so that everything had its own place. The
banner had its space on the top, the menu to the left and the content placeholder had
its space to the right of the menu and below the banner as seen in figure 4.6. From the
toolbox navigation tab I dragged and dropped a menu onto the area for the menu. To get
the menu to work and so that the user can click a link and that the page will be shown in
the content placeholder I had to add an Xml file. I named the xml file Web.sitemap this
because it is the default name of a sitemap and the program will then automatically know
where it belongs to, this can be change in the sitemap datasource. The sitemap contains
the name that will be shown in the menu and the URL to the page that will be shown
in the content placeholder. Now basically the master page is finished and now only the
other pages specified needed to be implemented. I knew that a database was going to be
needed in the project so I started to search information in how to implement a database in
Visual Studio 2005. I found some information and tutorials [25, 26] that I read through.
I added a new database item to my project. Here it is possible to add tables and stored
procedures. I created the tables that were specified in the ER diagram. The creation of
data tables can be seen in figure 4.7. In the creation I added all the columns needed and
chose a data type for the column. Now I had a working database and could then continue
to create the rest of the specified pages.
27
customer presses the submit button on the page all the information is processed within the
submit button_click method, see appendix A.2. First I create a sql [32, 33] datasource
and set the connection string to the database. Then I set the data source to use a premade
stored procedure that I made earlier. The stored procedure holds the sql insert query that
is going to be used. Then the method is implemented to fetch the data from the textboxes
and inserts them into the database table customer. When inserting the information into
the database I decided to save the customers Ip address and a date time stamp, this to
protect the site if the customer does anything illegal or if any problems happens with an
account it is easy to show who signed up for this account.
28
4.4.4 Login Page
The login page uses textboxes, labels and a button. When the page is loaded the cookie
that holds the information if a user is logged in is checked. If the cookie is not null the
visible flag of the labels, textboxes and buttons is set to false and an information text
that says "You are already logged in!". Another check that is performed when the page
is loaded is that it checks the cookie with information about which page the customer
were transferred from. If the cookie says that the last visited page was the create objects
page the information text "You must be logged in to create an object!" is shown. When
the customer presses the login button a sql query fetches the email, password, ip address
and the customer id from the database customer table where the email from the textbox
matches an email in the customer table. Then instead of decrypting the password in the
textbox it will be crypted with the crypt class (see 4.4.8) and check if it matches the
crypted password from the database. If the customer provided with the right password
the username and customer id cookie is set and the information text that the customer
has successfully logged in is shown. The username and customer id cookie is used to know
who is logged in.
29
4.4.6 Object Information Page
This page will show the object information. For showing the information about the oject I
used labels. On the page there is also a picture of the object that is shown and a hyperlink
which will transfer the customer to a page that shows all pictures of the object with the
belonging description. Implementing the code of the page I created a sql query that will
join the object database table with the picture table, doing this I only have to operate on
one table. The sql query fetches the object with the same object id that were passed from
the previous page 4.4.5. Having the query string i made the connection to the database.
A sql command were created and the parameter objectid were added to the sql command.
I then executed the sql command into a sql data reader that helps reading the information
from the database. Then i started to read the reader to get the object informatin that i
needed. The labels on the page were set with information by the data reader. After closing
the database connection I sat the object id cookie so the object id information could be
accessed from the show pictures page.
30
the first file saved on the disk and save the new resized image. The save picture class is
available in appendix A.4.
31
Figure 4.8: The GUI of Netbeans IDE 6.0
4.5.1 Beginning
I know could start my project. I started by creating the visual design of all the pages by
working in the design mode see figures 4.1, 4.2, 4.3, 4.4. Now having a prototype of
the desing I knew that I needed a database to save all the information about customers,
objects and pictures. I then started implement a database as specified in section 4.3. In
the service window I created a new connection and here I chosed to se the Apache Derby
database which is developed by Sun Microsystems. It know existed a database with a
connection and under this connection I added the tables that I needed. Within the tables
I created all the columns that I earlier had specified. Know I had a database were I could
save all the information.
32
propertie of the hyperlink url to the page the link should redirect the customer to when
clicked. Now I could use this fragment as an navigation bar in all my pages.
33
about the object, for example the dropdown lists is for choosing how many rooms the
object have. The data that the customer can choose in the dropdown lists is configured
into the default option of the lists. Here it is possible to configure the text that is displayed
for the customer and the output value that each text gives when chosen, when the customer
chooses the text 3 in the dropdown lists I sat the output value to be 3 and this is the value
that will later be saved into the database. I also used a dropdown lists for choosing in
which county the object lies. Here the customer can choose between all counties in Sweden
and the output value is equal to the text that the customer chooses. When pressing the
submit button the data provider row key is set to the next empty row in the database
table. All values from the text fields and dropdown lists are put into the data provider.
The customer id I sat to the customer that is logged in. The data provider commits the
changes made to the database, this is the step where the data provider actually saves the
data into the database. The customer is then redirected to the add picture page 4.5.4.
34
4.5.6 Show Objects Page
In the show objects page a table is used. In the table all the objects is shown. Some of
the objects information is shown in different columns and in one column there is a button
called information. If the customer clicks this information button the pages redirects
the customer to the object information page (see 4.5.7). In the method called when the
information button is clicked the row key is sat to the right row and the object id of that
row is written into the session cookie. On this page there are two dropdown lists where the
customer can narrow the shown objects in the table. The two dropdown lists is narrowing
the search in the categories county and city. The county dropdown lists is bound to a data
provider which get data from the county column from the object table in the database,
this is the alternatives it shows in the list. The city dropdown list gets in data from the
county dropdown list to only show the cities that lie within that county. This dropdown
list also gets its data from the database.
35
Chapter 5
5.1.1 Design
This testing will give a better idea in how the design can be configured. The main idea
of this website is that it should have a design that is attractive and that the site is easy
to navigate. In the comparison the different design of the components used for the con-
struction of the website will be compared in how they can be changed to give an attractive
appearance. Is it possible to change the components in every way? Which different layout
tools does the developer have access to and how can they be used.
5.1.2 Development
This area will show in how the developing tools as the components and other tools are easy
to understand and use. It will also give a better idea in how writing code as the methods
36
etc. What properties do the components have to help us to develop the website to have
the functions that we want? Is the data within the components easy to access and in what
way is it possible to alter the properties? In what way can we write the code for methods
like a button? Is it easy to store, retrieve and access data from the database?
5.1.3 Manageability
To keep a website updated there must be some way to manage the website to change the
information and pictures that the website holds. How is it possible to change information
and pictures within the website? Can the admin delete customers, objects and pictures
from the database? Is it much work to change the appearance of the website without
changing the functionality of the website?
5.2 Evaluation
5.2.1 Microsoft Visual Studio ASP.NET
At a first glance at Visual Studio the program seems very proffesional with a neat design.
Visual Studio have a rich toolbox with many components that may come in handy and I am
satisfied at what I see. Clicking around in the program it seems to have many functions
and options to help developing a website. Here is some of the components that I used
developing the website:
• TextBox The textbox is in it self a simple component that lets the user to write
text in it. In the properties window the textmode of the textbox can be singleline,
multiline or password.
• Label This component can hold text messages and can be changed whenever the
developer wants. Not much to talk about this component.
• RequiredFieldValidator This is used when it is requried that the user writes some-
thing in a textbox before submitting it. The component have a field which is set to
what component it should check. There is properties which in an error message can
be written that will be displayed in a validation summary when the validated control
is invalid.
• Button The button can be set to cause the validation to trigger. It can be set which
URL the button should post back to when clicked and other useful properties.
37
• ValidationSummary is where all the error messages appear and is shown. The
display mode of the component can be set so single line or bulleted list.
• DropDownList The data within the dropdown list can be configure to be static,
come from a datasource or to be hold both static and datasource values. The com-
ponent can be set to auto postback to the server after selection is changed.
• GridView shows the data in a table. The grid view shows the data from a datasource
which set in the propertie window. The grid view can be configured to have some
buttons. The buttons is delete, select and edit. The grid view also has a paging
function if wanted. There are a variety of other properties that can be change as the
spacing between columns and rows, cell spacing and cell padding and even more.
• DataList show the data as a list. The data list is set to a data source which shows
the data in the list.
• SqlDataSource The datasource is set to which database table it should get data
from and which sql query it should have. The sql query can either come from a stored
procedur or just plain text [32, 33].
Design
Designing the website there are many different tools to help getting the wanted appear-
ance. In Visual Studio the developer can choose to use Cascading Style Sheets which the
components can use to change the apperance [30, 31]. There are tables, divs, and other
tools to divide the page so that all the information ends up at the right place. In all these
page separators it is possible to set a background either a color or background picture. All
the components used to created the page can be configured in the propertie window which
CSS class name that will be applied to the control. The developer have full controll of
changing fonts, colors and borderstyles of the components. The different ways of showing
data as the grid view table and the data list table can be autoformated to different designs
but it is also possible to create the design of the table by hand. Designing a website in
Visual Studio is much fun and easy because there is many different ways you can alter it.
Having all this options makes it possible to make website that have different appearance
instead of having all websites looking the same.
Development
When starting developing using the tool box with all the components I think it has all
the most necessary components that can be used in the website. The toolbox consists of
different categories. The categories are standard, data, validation, navigation, login, web
parts, HTML, crystal reports, general and one categorie for AJAX extensions but that will
not be included in this report. As I said it has a very rich toolbox which I like. Using the
38
components there are a variety of properties to change the behaviour and appearance of it.
The data categorie where it is possible to show dynamic content from databases in Visual
Studio have many different approaches. For example the grid view shows the data as an
ordinary table and it can be configured in different ways to show columns and rows. The
rows can be deleted, selected and edited. The columns can be sorted in alphabetic order
and the table can be configured to use paging. That there is many different ways to present
the data gives the developer liberty to almost do what he wants. For validating data the
validation is used. These components is used when to ensure that the user types in the
right sort of data. For example the required field validator is used to ensure that the user
does not skip an entry and the regular expressions validator checks that the input data is
matches for example an email address. Implementing code in the website the developer can
choose to write the code in Visual Basic (VB) or Csharp (C#). Implementing the website
for this project I wrote the code in c#. Implementing the code I did not encountered
any problems. It was easy to implement getting the data from the database, this from
having a useful data source and good documentations from MSDN. One flaw is that when
deleting for example a method an error occurs when building the project because that in
the ASP code area of the component that the method belongs to the ASP code says that
this method should exist. But a big plus to this is that the debugger point out exactly
where the problem exists.
Manageability
Managing the website by updating it and changing the appearance should not be a problem.
Changing the appearance is not much work using Cascading Style Sheets (CSS) [30, 31] and
that the components are associated with a different class in the CSS. Then the developer
just has to change the attributes in the CSS to change the wanted appearance. If the
information that is written on the website should be altered the text can be read in from a
file that can be edited by some text editor. Changing images that are visible in the website
can be done by just replacing the image or having different numbers of images the images
can be loaded from a database and shown with some sort of data viewer.
• TextField is the component where the user types in information. The text field
have built in label in the propertie window where the component can be described
for the user. The label can be set to be placed over the text field or to the left of it.
• PasswordField the data in this text field will not be visible for the user.
39
• Label This component can hold text messages and can be changed whenever the
developer wants. This component is usually associated with another component.
• Table is the component that can show data from example a database. The table is
associate with an data provider to show database objects. The table can be configured
to have paging, sorting and other properties. There are also other properties that
can be change as cell padding, cell spacing, etc.
Design
Designing the website in Netbeans IDE Cascade Style Sheets is the way that is preferred.
To make the layout divs is the best way to do it. This is shown in some tutorials on the
Netbeans website [21]. It is also possible to use tables but what I found there where no
component for this so the way to do it is to write JSP or HTML tags. But there is enough
with components to draw a fine design and layout. Implementing the design in Netbeans
IDE some problems was encountered. The problems is that when drawing the design in
layout mode sometimes the layout shows faults as components, divs etc showing up on the
wrong place. Another problem is when using fragment the fragment can end up in wrong
place when using the website even if it lies in the right place in the layout mode. Having
these small bugs makes it pretty difficult to know what to do and if there is something
wrong. Restarting the program often solves the problems. This layout mode window has
too many faults and this gives it a big minus.
Development
Developing in Netbeans IDE there is a useful palette that contains all the main components
needed for developing a website. The palette have different catgories which holds the
different component, the catgories are basic, layout, composite, validators, converters,
standard, advanced, data providers and advanced data providers. Netbeans have also the
option where you can add AJAX components but that will not be included in this report.
Developing using the components text field, dropdown list and some other components have
a useful propertie that it is possible to have the label ontop of the different components.
This label exists in the component and are not a standalone component. When showing
data from the database there are not any different ways to do this what I could found.
Using the dropdown list I had some problem because it can not have static objects in
the list and at the same time have data objects from the database. And when using the
auto submit on changes option in the dropdown list it calls all dropdown list methods
instead of just call the dropdown list method that invoked the change. This is of course
a matter of taste. The components that exists are not that many and the documentation
40
how they work is not well documented this makes that developing for the first time with
Netbeans takes little longer than having documentation. Beside that and have learned the
components I think i works just fine. When writing code in Netbeans the language used
is Java. The code part works without any major problems. One big set back is that when
an error is made in the coding part it is not possible to change view to the design and JSP
view. I came accros another problem which is that sometimes deleting components and
code parts the debugger warnes for error that is inside parts that is written by the program
and these problem is very hard to find and sometimes impossible. When developing a longer
amount of time with Netbeans it becomes very slow and sometimes it stops working and
the program have to be rebooted. Switching between the different developing views when
changes have been made is also very slow.
Manageability
Managing a website by using Netbeans should not be a problem. Updating and changing
the apperance is not that hard if Cascade Style Sheets are used, then the developer only
have to change the CSS to get another apperance of the website. All images belonging to
the website can be saved in the same folder then when changing pictures they just have to
be owerwritten by the new one. Have a dynamic amount of pictures they can be saved on a
database and showed with an table component the flaw here with Netbeans is that they by
default dont have many different ways of showing dynamic content. The text information
can be loaded from a text file of any sort, then it is easy to change the content on the page
by just editing the text file by using a text editor.
5.3 Results
The overall winner in comparing the both is the Microsoft Visual Studio ASP.NET plat-
forms. The Visual Studio platform have a much better performance than Netbeans IDE
that I found a bit slow and encountered a numerous of bugs. Visual Studio also has a much
more complete set of useful components. The documentation in Netbeans is very poor com-
pared to the Visual Studio that has a complete set of documentation of all components
and other stuff within the developing and implementation area. But with consideration
that Netbeans IDE is an open source platform I think it is pretty useful apart from the
annoying bugs. But having this in mind Microsoft also have a free web developing platform
called Visual Web Developer 2005 Express Editions that works just like the one found in
Visual Studio 2005.
5.3.1 Design
When designing both Websites with the different platforms I could draw the conclusion
that Visual Studio is clear winner of this. Both platforms have the right prerequisite
to designing a good website. They both support Style Cascade Sheets (CSS) and got
41
properties to alter the looks of a website. But Netbeans IDE have many issues of creating
the visual guidance for the developer. It exists too many bugs such as that the visual
layout window doesn’t update like it should and components end up with wrong attributes
and in the wrong place. This is a big disadvantage not seeing how the website should look
when running it.
5.3.2 Development
Developing the website using the included components of the platforms helps a lot and
both platforms have many functional components. Some of the components are harder to
use than others and here documentation is a big help. Visual studio have a much better
documentation of their components than Netbeans IDE but some of the Netbeans com-
ponents are easier to understand than the Visual studios. Implementing the code behind
buttons etc Visual studio have a big advantage with a better debugger than Netbeans
because Netbeans sometimes have problem with pointing out the errors and when error
occurs it is not possible to change to the layout mode in Netbeans. This I would also say
that Visual studio takes home a narrow victory.
5.3.3 Manageability
Managing the websites using the different platforms is pretty easy because of the use of
CSS. This helps allot when changing appearance of the website. Changing and updating
image is neither any problem in any of the platforms. This comparison scenario is a tie
between both the platforms with not finding any difference between them.
42
Chapter 6
6.1 Conclusions
The conclusion from the comparing is that Visual Studio with its web development platform
is ahead of Sun Microsystems Netbeans IDE. Even though Netbeans seems to be a fine
development program it has too many bugs. The web development area is bigger than it
seems. Today it is possible to develop programs from on the internet that works just like a
local program on you computer and the area is growing. Working with this project I have
learned to created dynamic web pages in both JSP and ASP platforms. I would say that
there is not much difference between developing a website in any of them. The thing that
was much work with and I had to read a lot about is the mastering of database and sql
queries. But when I got a grip on the basics it was not much work learning the rest. But
to create a website with nice looks and design a designer is almost needed. I found doing
this project that it could be much fun implementing a website and I have also learned a
lot during these weeks.
43
Bibliography
[1] Martin Höst, Björn Regnell and Per Runeson, 2006, Att genomföra examensarbete,
Printed by Narayana Press
[4] HiTMilL (Cheryl Gribble), Updated 06 March 2007, Introduction, last checked 2008-
02-25,
URL: http://www.hitmill.com
44
[13] Microsoft Corporation, IIS, last checked 2008-02-25,
URL: http://msdn.microsoft.com/msdnmag/issues/02/09/Passport/
[27] Sun Microsystems, Sun Java System Application Server Platform Edition 9, last
checked 2008-03-07,
URL: http://docs.sun.com/app/docs/coll/1343.3
45
[28] Sun Microsystems, Java Information, last checked 2008-03-07,
URL: http://java.sun.com/javaee/5/docs/tutorial/doc/docinfo.html
[29] Sun Microsystems, Sun Java System Application Server Platform Edition 9,last
checked 2008-03-25,
URL: Sun Java System Application Server Platform Edition 9
[33] Mälardalens Högskola IDt, Structured Query Language and Database,last checked
2008-03-28,
URL: http://www.idt.mdh.se/kurser/cd5430/
46
Appendix A
A.1 CreateObject.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
// If no user is logged in
if (Request.Cookies["UserName"] == null)
{
HttpCookie myCookie = Request.Cookies["PreviousPage"];
myCookie["PreviousPage"] = "CreateObjecNotMember.aspx";
Response.Cookies.Add(myCookie);
Server.Transfer("Login.aspx");
}
}
A.2 CustomerSignUp.aspx.cs
public partial class CustomerSignUp : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie myCookie = Request.Cookies["PreviousPage"];
if ( Request.Cookies["PreviousPage"] != null)
{
if (myCookie["PreviousPage"] == "CreateObjecNotMember.aspx")
{
InformationLabel.Visible = true;
47
}
myCookie["PreviousPage"] = "CustomerSignUp.aspx";
Response.Cookies.Add(myCookie);
}
PHDataSource.InsertCommandType = SqlDataSourceCommandType.StoredProcedure;
PHDataSource.InsertCommand = "InsertCustomerInformation";
PHDataSource.InsertParameters.Add("Firstname", FirstnameTextBox.Text);
PHDataSource.InsertParameters.Add("Lastname", LastnameTextBox.Text);
PHDataSource.InsertParameters.Add("Email", EmailTextBox.Text);
PHDataSource.InsertParameters.Add("IPAddress", Request.UserHostAddress.ToStrin
int rowsAffected = 0;
try
{
rowsAffected = PHDataSource.Insert();
}
catch (Exception ex)
{
// Att göra: Skicka till windows error log
Server.Transfer("Problem.aspx");
}
finally
{
PHDataSource = null;
}
if (rowsAffected != 1)
{
Server.Transfer("Problem.aspx");
48
}
else
{
Server.Transfer("Welcome.aspx");
}
}
}
AS
BEGIN IF @Housetype != ’1’ AND @City != ’1’ AND @County != ’1’
SELECT * FROM Object
WHERE Housetype = @Housetype AND City = @City AND County = @County
ELSE IF @Housetype != ’1’ AND @City = ’1’ AND @County = ’1’
SELECT * FROM Object
WHERE Housetype = @Housetype
ELSE IF @Housetype = ’1’ AND @City != ’1’ AND @County = ’1’
SELECT * FROM Object
WHERE City = @City
ELSE IF @Housetype = ’1’ AND @City = ’1’ AND @County != ’1’
SELECT * FROM Object
WHERE County = @County
ELSE IF @Housetype != ’1’ AND @City != ’1’ AND @County = ’1’
SELECT * FROM Object
WHERE City = @City AND Housetype = @Housetype
ELSE IF @Housetype != ’1’ AND @City = ’1’ AND @County != ’1’
SELECT * FROM Object
WHERE County = @County AND Housetype = @Housetype
ELSE IF @Housetype = ’1’ AND @City != ’1’ AND @County != ’1’
SELECT * FROM Object
WHERE City = @City AND County = @County
ELSE
SELECT * FROM Object
END
RETURN
49
A.4 SavePic.cs
public class SavePic
{
public static string Save(FileUpload file)
{
// Specify the path to save the uploaded file to.
string savePath = "~\\Images\\";
System.Drawing.Image.GetThumbnailImageAbort myCallback =
new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
Bitmap myBitmap = new Bitmap(savePath);
int width = 0;
50
int Height = 400;
myBitmap.Dispose();
try
{
using (StreamWriter sw = File.CreateText(savePath)) { }
File.Delete(savePath);
}
finally
{
myThumbnail.Save(savePath);
}
return fileName;
}
public static bool ThumbnailCallback()
{
return false;
}
public void Save()
{
// Add constructor here
}
}
51
A.5 Crypt.cs
public class Crypt
{
// Encrypt a byte array into a byte array using a key and an IV
public static byte[] Encrypt(byte[] clearData, byte[] Key, byte[] IV)
{
// Create a MemoryStream to accept the encrypted bytes
MemoryStream ms = new MemoryStream();
// There is also a mode called ECB which does not need an IV,
// but it is much less secure.
alg.Key = Key;
alg.IV = IV;
52
// Close the crypto stream (or do FlushFinalBlock).
// This will tell it that we have done our encryption and
// there is no more data coming in,
// and it is now a good time to apply the padding and
// finalize the encryption process.
cs.Close();
return encryptedData;
}
53
// 8 bytes and so should be the IV size.
// You can also read KeySize/BlockSize properties off
// the algorithm to find out the sizes.
byte[] encryptedData = Encrypt(clearBytes,
pdb.GetBytes(32), pdb.GetBytes(16));
}
public Crypt()
{
// Add constructor here
}
}
54
Appendix B
customerDataProvider.setValue("FIRSTNAME",
String.valueOf(firstnametextField.getText()));
customerDataProvider.setValue("LASTNAME",
String.valueOf(lastnametextField.getText()));
customerDataProvider.setValue("Email",
String.valueOf(emailtextField.getText()));
customerDataProvider.setValue("IPADDRESS",
IPAddress.getHostAddress());
customerDataProvider.setValue("PASSWORD",
String.valueOf(passwordField.getText()));
customerDataProvider.commitChanges();
} catch (Exception ex) {
log("Error Description", ex);
error(ex.getMessage());
}
return null;
}
55