UK Sales: 0800 035 6364 | sales@2020media.com | We'll Call You

Getting Started with ASP.Net

 

Requirements

 

Your account detail e-mail/letter

 

Introduction

 

Early in 2002, Microsoft released its new platform for Internet development. Dubbed .NET, this platform included the long-awaited successor to ASP. Originally entitled ASP+, it was finally released as ASP.NET under the new naming scheme for Microsoft's Internet development products.

Compared to ASP, ASP.NET represented a leap forward both in complexity and productivity for the developer. It maintains its flexibility in the choice of language, but instead of a range of simple scripting languages, developers must choose between several full-fledged programming languages. Development in ASP.NET can require not only an understanding of HTML and Web design, but also a firm grasp on the concepts of object-oriented programming and development.

A good introduction to using ASP.Net can be found here

 

Documentation

 

Full documentation is available here

 

Here's a simple web page you can use to test ASP.Net
Just create a text file with the following contents:

<%@ Page LANGUAGE="JScript" SRC="helloworld.aspx.js"
INHERITS="ASPPlus.codeBehind" %>
<HTML>
<HEAD>

<TITLE>Hello World Test</TITLE>
</HEAD>
<BODY STYLE="font-size:12; font-family:arial,verdana,sans-serif;">
<FORM RUNAT="server">
<P ALIGN="center"><ASP:LABEL ID="message"
RUNAT="server"></ASP:LABEL></P>

</FORM>
</BODY>
</HTML>


Save it as a .aspx file - eg test.aspx and upload it to your account. The view it with your web browser at http://www.domainname.com/test.aspx

ColdFusion MX Help

General Information
Setting Up
Restrictions
Common Problems
Further Reading


What is ColdFusion MX?


ColdFusion is a set of Web development products developed by Allaire, which has now merged with Macromedia/Adobe.

The ColdFusion development environment makes it easy for you to build dynamic Web sites and Internet applications. With ColdFusion, you can develop a site or application that pulls data from a content database and then use templates to dynamically create Web site pages using the content stored in your database. ColdFusion is often used to build ecommerce sites.

ColdFusion enables you to perform tasks such as:

• Query existing database applications for data.
• Create dynamic queries facilitating more flexible data retrieval.
• Execute stored procedures in databases.
• Enhance the standard HTML form capabilities with data validation functions.
• Dynamically populate form elements through database retrieval.
• Customize the display dates, times and currency values with formatting functions.

ColdFusion includes ColdFusion Studio, which you can use to design and develop your templates, and ColdFusion Server, which interacts with relational databases and serves the Web pages to your users. ColdFusion Server is what 2020Media provides to you.

How to create a ColdFusion website

Because ColdFusion integrates its code (CFML) with standard HTML code, you can use any standard Web development application or a text editor to develop your templates. However, if you plan on building a large or complex site, you may find it helpful to use ColdFusion Studio.

Versions

We offer Coldfusion MX Professional, Macromedia's latest version as at 2002/2003. We also have legacy support for ColdFusion 4.51 and this will be phased out in 2003. CFMX is run on Windows and CF 4.51 is hosted on Linux.

Databases

MySQL is offered as standard with CFMX. You can also use Access at no charge, or upgrade to Microsoft SQL server at additional cost. Contact 2020Media Sales for details. ColdFusion supports both DSN and DSN-less connections.

ColdFusion variable settings

The default setting (and maximum value) for session variables is 20 minutes.
The default setting (and maximum value) for application variables is 2 days.

CFHTTP workaround

The CFHTTP tag does not work as described in the ColdFusion Manual due to security restrictions in a shared environment. Specifically, if the METHOD attribute is set to "GET" then the #CFHTTP.FileContent#variable cannot be used to retrieve data extracted with CFHTTP.

You can work around this problem by using the PATH and FILE attributes to specify where the file should be created. Instead of using the CFHTTP.FileContent variable, read the downloaded file using CFFILE tag from the location specified in the CFHTTP PATH attribute. You may want to use a special directory for the PATH to these temporary files, as you will need to grant write access to the directory.

Using CFQUERY to access an ODBC DSN

Once you have created an ODBC Data Source Name for your database, you can use CFQUERY:

<CFQUERY Name="myqueryname" DATASOURCE="DSNName" USERNAME="username" PASSWORD="password">

Sending an email from your application

To send an email from a ColdFusion application, you use the CFMail tag. The following sample code illustrates how you can send a confirmation email to a visitor:

 

<CFMAIL to="#ContactEmail#" from="From Email" Subject="The Subject">

Thank you for your message,
We'll be in touch as soon as we can. Thanks for visiting our site,
Webmaster
You wrote:
#ContactMessage#
Message By: #ContactName# - #ContactEmail#
==================================
</CFMAIL>

RDS (Remote Development Services)

When discussing ColdFusion, RDS stands for Remote Development Services. Because RDS is not designed for a shared hosting environment, it presents a high security risk and is not enabled on 2020Media's shared servers

Coldfusion Tags

We can install custom tags by arrangement and approval by our technical support team. You can place your custom ColdFusion tags (.cfm) in any directory under your /www directory. Once you have uploaded your files, you will need to use the CFMODULE tag to specify the location of your .cfm tags.

If you call custom CFM tags directly, the custom tag must be placed in the same directory as the calling template. We support both CFX and CFFILE tags by default.

Can I use ColdFusion in conjunction with ASP?

Yes you can, but we do not offer technical support for ASP if you have purchased a ColdFusion package. You will need to order an ASP hosting package to gain technical support

"Data Source Not Found" error.

If you are receiving this error, make sure that you have created the DSN. You should also check for any spelling errors.

"File Not Found" error.

This error indicates that the ODBC driver can not find the file in the location it expected. To try and resolve this problem, perform the following steps:

• Ensure that you have created the data files.
• Check the ODBC source settings and spelling.
• If the file has been moved, manually update the file location information for any ODBC sources that reference the file.
• Check that the database file defined by the DSN has not been renamed.


Parameter errors.

Parameter errors occur when a SQL statement references a field name that does not exist in the data source. You should check the SQL statement or query indicated in the error message and verify that:

• You are using the correct data source with the query.
• The fields exist and you have spelled their names correctly.
• Any literals or strings in the query are enclosed in single quotes.

Further reading about working with ColdFusion

There are a number of resources that can help you as your work with ColdFusion, including:

http://www.dantor.com/support/cfdocs/
http://www.easycfm.com/tutorials/
http://www.macromedia.com/support/coldfusion/documentation.html
http://www.macromedia.com/v1/documents/cf4/dochome.htm

 

Tomcat JSP

 

Requirements

 

A Java+ Account
Your account detail e-mail/letter
A basic knowledge of Java and JSP / Servlet technology

 

Using JSP

 

Testing your account

 

To test your account is correctly set up for servlets, open up a web browser and go to

 

http:// webserver /mountpoint / test2020.jsp

 

where

 

webserver is the name for your web server
mountpoint is the name of the mount points for servlets.

 

Both of these are in the account detail letter.

 

This should bring up a page looking like:

 

2020Media Apache Tomcat Java Server Pages

Welcome to the world of JSP!

 

 

 

If this does not happen, then contact support.

 

Your Tomcat JSP Account

 

Directory Structure

 

Home Directory/

 

Servlets vs. CGI scripts

As most developers realize, the advantages of CGI technology are many. Not only has it been around forever and is tried and true, but scads of good CGI scripts exist online for the plucking. Most every Web server speaks some dialect of CGI, and almost all ISPs offer some level of CGI user support. So why should you even consider forsaking CGI for Java servlets?

The following chart compares and contrasts Java servlets with CGI scripts. Scores in each category range from very low to very high. Note that the picture this chart paints is, to some extent, subjective, since there are no hard-and-fast scoring rules in most categories. With that grain of salt:

  Java servlets CGI scripts
Ease of creation Medium Medium
Depending on their degree of functionality, Java servlets, like Java applets and applications, can be quite challenging to code. However, the basic model for servlets (as discussed on the next two pages) is a refreshingly simple and straightforward one. Tons of excellent Java IDEs exist, making your job as servlet creator potentially much easier. Again, bare-bones CGI scripts are really quite simple to code, but the difficulty increases exponentially with higher functionality. Since CGI is a specification (for data exchange) rather than a language, you can leverage your existing programming skills by coding CGI scripts in your language of choice: Perl, C/C++, Tcl, Visual Basic, and, yes, even Java.
Execution efficiency High Low
A servlet runs in a single process (within the server process). Thus, unlike CGI scripts, a new process does not have to be spawned for each new request for the servlet. This makes for low execution overhead and high efficiency. It also enables a servlet to handle multiple concurrent requests with ease and elegance. Moreover, since there is only a single instance of the servlet in existence (all concurrently running instances are actually threads of the main instance), server memory drain is minimized, and data persistence is enabled. A CGI script often spawns a new process every time it is invoked, thus causing a noticeable lag in transfer speed and potentially consuming great gobs of server processing time and resources. I say "often" because there are CGI technologies, such as FastCGI, that minimize script-invocation overhead. But even the best of these does not provide as effective of a solution as the one deployed by Java servlets.
Server support Medium High
Servlets can be supported on a large number of popular Web servers, but not all ISPs offer this support. CGI scripts can be, and are, supported by the great majority of existing Web servers. Harder to come by are ISPs that will allow users to upload their own custom CGI scripts (for obvious security reasons, since CGI scripts, like Java servlets, have the power to wreak system havoc).
Platform
independence
Very high Medium
After all, we are talking about Java here: "Write once, run anywhere." Perl, when coded correctly, is almost completely platform independent. However, many other CGI-capable languages (such as Visual Basic) are not.
Availability Medium High
Online servlet repositories exist, but their number and breadth/depth of offerings do not rival those of CGI script repositories. Online CGI script repositories abound. From these, you can acquire custom CGI scripts to upload to your server. Or, if your server won't let you install custom scripts, you can take advantage of the many remotely hosted CGI scripts out there.
Security High Low
The strict Java servlet security model (Security Manager) and servlet sandbox safeguard your system from both intentional and accidental malicious servlet behavior. The mechanism of trusted (digitally signed) servlets allows for increased servlet capabilities. Since CGI scripts are not subject to the same degree/granularity of security sandboxing as Java servlets, they are significantly less secure.

Trouble deciding?
If you're comfortable programming in Java and your Web server supports servlets, go with servlets instead of CGI scripts, particularly if your application will be getting a large number of concurrent hits. Also, since servlets can avail themselves of all the standard Java API goodies, they are better than CGI scripts for large-scale server-side applications. And finally, if security is critical, stick with servlets.

If, on the other hand, Java is not your cup of tea, your Web server is servlet-shy, or you've found the perfect Perl script to tweak a bit and upload, go with the CGI.

There are of course other server-side technologies in use today: JSP (Java Server Pages, which extend servlets), ASP (Active Server Pages, on Microsoft servers), SSI (server-side includes), PHP, Python, server-side JavaScript, and more. JSP and ASP are competing behemoths and beyond the scope of this article, while the other languages are either significantly less powerful (SSI) or not as widely used (server-side JavaScript) as Java servlets and CGI scripts.

 

 

This information is from CNET. All rights acknowledged.

Rick Scott has been a programmer, tester, layout artist, instructor, multimedia developer, Web site designer, technical writer, and frequent contributor to ZDNet Developer. He thanks colleague and friend Jeff Sonstein for server-side Java expertise.

Java Tomcat Accounts

This page describes how to use your Java Account.

Requirements

Your account detail e-mail/letter
A basic knowledge of Java and Servlet technology

Using Servlets

Testing your account

To test your account is correctly set up for servlets, open up a web browser and go to

http:// webserver /mountpoint / test2020

where

webserver is the name for your web server
mountpoint is the name of the mount points for servlets.

Both of these are in the account detail letter.

This should bring up a page looking like:

2020Media Apache Tomcat

Welcome to the world of servlets!

 

 

 

If this does not happen, then contact support.

Your Tomcat Servlet Account

Directory Structure

Home Directory/

html files

WEB-INF/

classes/

class files

lib/

jar files

web.xml
src/
source files

logs/
log files


WEB-INF Directory

In your account there will be a directory called 'WEB-INF' with a sub-directories 'classes' and 'lib'. The 'classes' directory contains the classes for the test page and also for any servlets that you generate, and the 'lib' directory contains any jar files.

The mapping between the URL's and particular servlets is controlled via the XML file 'web.xml'. For each servlet that is directly accessed via a URL there are the following lines (for the servlet 'test2020'):

    < servlet >
< servlet-name >
test2020
< /servlet-name >
< servlet-class >
test2020
< /servlet-class >
< /servlet >
< servlet-mapping >
< servlet-name >
test2020
< /servlet-name >
< url-pattern >
/test2020
< /url-pattern >
< /servlet-mapping >

An example version of the file, which runs the demo servlet is in the directory and it is recommended that you use this as a template.

Downloading Servlets

You can either download servlet class or jar files into the 'classes' or 'lib' directory or by downloading the source files and compiling them on the server. It is quite common for people to develop their applications 'off-line' and then just download the completed files when ready.

Compiling Servlets

Java 2 is installed on the server, and you can compile your servlets with javac.

For example the test servlet was compiled using

(in the src directory)

javac -d ../classes test2020.java

Debugging

Once the class files are installed, the main source of debugging information are the logs from Apache / Tomcat. These log files are available to developers on the password protected web page:

http://webserver/logs/errorlog.shtml

If you require further assistance then contact us

Further Information

Using SSH

Using Servlets and MySQL

Finally

We hope that this page has made setting up and using servlets as painless as possible. If there is anything we have left out, or you have further comments, please Contact Us.

Page 2 of 2

2020Media is a leading provider of small business Wi-Fi hotspots. If you want to offer free Wi-Fi to your customers or users, our service could be exactly what you are looking for. Our Hotspots are managed in the cloud, ultra-reliable and give you loads of information about behaviour patterns of your users. Read More   Read more...
2020Media introduces Moodle Hosting - UK servers and UK Moodle experts setup your site ready to use. Read more...
Special Offer for Longer Registration Periods Register or renew a .com, .net or .org domain name for 5 years we'll include 1 year free*. Read more...
2020Media is now offering zero-click installation of the popular TYPO3 content management system. Read more...

Our blog is regularly updated with news, tips and industry opinion.

Clients

  • AggieWestons
  • baker-and-mckenzie
  • arts-council-england
  • Big Finish
  • barratt-developments-logo
  • City-of-Lincoln-council-logo
  • brora-logo
  • DenisMacShane
  • Construction-Industry-Council
  • colchester