WebReference.com logo
tip archive  •   about  •   sitemap  •   contact  •   jobs  •   write for us  •   subscribe


[next]

Creating a ASP.NET Contact Form

By Ryan Butler

Social Bookmark

Java Developer- 2 openings! (NYC)
Next Step Systems
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume


When developing a website for business, personal or organizational use, having a reliable, secure and intuitive way of ascertaining information from your visitors in an effort to better meet their needs, creating and developing a contact form is essential. Creating a form allows website owners to ask for specific information from the visitor in an effort to respond back to them in a way that seems meaningful and useful. However, if precautions are not taken, creating these forms can lead to abuse, misuse and incorrect information getting back to the business, person or organization, and in most cases, leading to a mess of unsolicited electronic mail that wreaks havoc on email systems.

In this article, we will look at creating a ASP.NET contact form that will allow us to capture specific information that we need, validate form fields using client and server side languages to ensure that fields are not empty and then send the results to a specified recipient (s) that will allow them to respond to the visitor in depth when time and information permits. In order to do this, we need to download and install the .NET framework, install Internet Information Services (IIS), understand client-server architecture and its relation to web programming. If you would like to learn how to create such a form, as well as learning about these concepts in-depth please follow along with the article below.

Requirements

In order for us to work effectively, we’ll create our form through Internet Information Services (IIS) on our local computer and then transfer the files to our remote host. There are a variety of reasons for taking this approach including: (1) some hosts have low remote connectivity timeouts which makes developing these types of forms difficult to accomplish remotely, (2) you have more flexibility debugging your code locally and (3) most hosts don’t allow direct access to their server from within an editor. As a result, we’ll need the following software installed on our computer:

Pre Download Information

For the purpose of this article, it’s assumed you have Windows XP Professional installed. Continuing, let’s first download and install the .NET framework from Microsoft. If you’re wondering why we’re skipping Internet Information Services (IIS) at the moment, it’s because often times if you install IIS before installing the .NET framework, IIS will not install and configure some of its services correctly, including the association it has to the .NET framework, among others.

Download and Install .NET Framework

In order to download and install the .NET framework, open your preferred web browser and follow the web address below:

http://www.asp.net/downloads/essential/

From this page, you’ll see two download areas, one for the .NET framework and one for Visual Web Developer Express; choose the .NET framework. Once you click the link, you’ll be prompted to save the executable file to a location of your choice, once downloaded, double click the file and follow the steps.

Download and Install Visual Web Developer Express

In order to download Visual Web Developer Express, return to the web address provided above, click the download link, and once again, you’ll be prompted to save the executable file to a location of your choice; once downloaded, double click the file and follow the steps.

Installing Internet Information Services (IIS)

You may be wondering at this point, if we need to bother with installing Internet Information Services (IIS) since we already installed the .NET framework and Visual Web Developer. Even though we have the framework installed, which gives us access to the classes, web controls and resources needed to create our form, when working with web applications we still need a web server that is capable of accepting our request from the client’s browser, parsing server side web controls, programmatic code and then sending the result back in html so that a web browser can understand and render the web page appropriately. More on the concept client-server architecture will be covered later in the article.

In order to install Internet Information Services (IIS), follow these steps:

Once this is complete, close all windows. We’ll need to test and verify the ASP client was registered with IIS.

Testing Local host (IIS)

Before continuing, let’s ensure IIS is installed and configured properly to handle ASP.NET. Open your preferred web browser and type the following address:

http://localhost/

If you get an error screen, don’t panic. Sometimes during the installation and configuration of the .NET framework & IIS, the ASP client isn’t registered with IIS. It’s nothing to fret about and can be easily fixed by opening a command line and typing the following:

C:\WINDOWS\Microsoft.NET\Framework\[version]\aspnet_regiis -i

…where version is the version of the .NET framework installed on your computer. Once this is complete, refresh your browser and a welcome screen should show.

Create a Virtual Directory/Application

In the ASP.NET environment, when creating web forms, you’ll want to create them within a virtual directory or application in IIS. Associating web forms to a virtual directory or application within IIS allows your application to operate more efficiently and allows your application access to features that makes working with ASP.NET web forms far easier than most server side environments. Such features include:

More on the intricacies of these files will be discussed later in the article.

In order to create a virtual directory or application in IIS, you need a physical folder setup on your hard drive. Once completed, follow the steps below to open IIS:

Close the IIS window and open Visual Web Developer Express; we’re ready to begin creating our contact form.

Open Local Web Site from Visual Web Developer Express

When you first open Visual Web Developer Express, a start up screen will show with a default language setting. For the purposes of this article, we’ll be using C# (pronounced C-sharp). To open our web application, follow these steps:


[next]

Recent Articles

WebReference.com site name
Building a Banking Application Home Page with OOP
Mixing Scripting Languages
Review: phpFox, a Social Networking CMS with all the Bells and Whistles
internet.com site name
Enterprise 2.0: Social Networking in the Cloud
BroadSoft Marketplace Hastens Pace of Telephony Innovation
Review: HTC Hero for Sprint


internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs