Working with Visual Studio.NET Web Applications

Working with Visual Studio.NET Web Applications

In this tutorial – Introducing Visual Studio.NET Web Applications, You will learn How Web Applications Work, Choose a Language for creation.

Microsoft’s commitment to rapid application development is reflected in Visual Studio 2005 2.0. The .NET framework has blurred the lines between the different programming disciplines and made application development of any kind pleasurable. Web application development specifically has received a boost. With Visual Studio.NET 2005, the facilities available for the Web application developer has been enhanced multifold.

Web applications are of four types. The Web Applications use the power of the Client server technology, and enable the user view applications on a web browser. The Web Services are components that provide processing services from a server to other applications that are deployed over the Internet. Internet Enabled Applications that incorporate all the features of the Internet and provide for online registration, help, updates and other services and Peer to peer applications that use the internet for communication with users running instances of a standalone application.

The difference between web applications and stand alone applications lie in the relative locations of the application and the interface. In stand alone applications, the application and the interface lie in the same machine and messages are passed between the two via the operating system. In Web applications the application lies on a server or a remote machine and the interface can reside in one or more machines located elsewhere. Messages are passed between the two over a network. This difference introduces a number of architectural requirements for the Web application. These include the architecture for messaging over a network. Manipulation of user interface, security, handling multiple users, Identification and state of the users are other factors which are of prime importance for web developers.

How Web Applications Work

Web applications reside on the server and responds to requests made by client systems over the internet. The application is managed by the Microsoft Internet Information Services and the information is passed to the client through the Hypertext Transport Protocol (HTTP) which is a set of rules that describes how two or more items must communicate over a medium such as the Internet. The client hosts a browser on which the web application becomes accessible. The user interface takes the form of a Hypertext Markup Language(HTML) page that are interpreted and displayed on the client’s browser.

A Web Application consists of three parts—content, program logic and Web configuration information. Content defines the type of interface that will be presented to the end user. Web forms, HTML images, audio, Video and other data are part of content. Program Logic defines how the application will respond to user action. This is stored in the form of Executable files, scripts etc. The configuration information determines how the application runs on a server, who can access it etc. The Web configuration file, style sheets, IIS settings etc are the types of files that determine the web configuration.

ASP.NET is the platform on which Visual Studio.NET Web applications are developed. This platform provides a wide level of consistency across web applications and is made up of several components as under:

  • Visual Studio .NET Web development tools which include visual tools for designing Web pages and application templates, project management, and deployment tools for Web applications.
    .
  • The System.Web namespaces are part of the .NET Framework and include the programming classes that deal with Web-specific items such as HTTP requests and responses, browsers, and e-mail.
    .
  • Server and HTML control are the user-interface components that you use to gather information from and provide responses to users.

Additionally, ASP.NET relies on Microsoft Internet Information Services to hosts web applications ( the cassini server is integrated for use during development phase in the Beta Version 2.0), the Microsoft Visual Basic.NET or C#.NET or J#.NET programming languages, the .NET framework, the Microsoft ADO.NET database classes and tools and the Microsoft Application Center Test(ACT) for creation and deployment of Web applications. However ASP.NET is not platform independent. It runs only on Windows servers and other tools must be used for creating applications that run on Linux /Unix platforms.

Choosing a Language for creation

The .NET framework makes it possible for web application developers to choose the language of programming they are familiar with. The only condition being that the language should be CLR compliant. In addition to the VB.NET , C#.NET and J#.NET languages incorporated into the .NET framework, the developers can now work with Perl, Pascal, Eiffel, Cobol, Python, Smalltalk and a number of other programming languages. In this tutorial we shall be selecting C# as the language of programming. The following table compares two of the popular programming languages of the .NET framework.

Feature

Visual Basic .NET

Visual C# .NET

Case sensitive

Not case sensitive:
response.write("Yo") ‘ OK

Case sensitive:
response.write("Yo"); // Error!
Response.Write("Yo"); // OK

Functional blocks

Use beginning and ending statements to declare functional blocks of code:
Sub Show(strX as String)
Response.Write(strX)
End Sub

Use braces to declare functional blocks of code:
void Show(string strX)
{
Response.Write(strX);
}

Type
conversion

Implicit type conversions are permitted by default:
Dim X As Integer
X = 3.14 ‘ OK

You can limit conversions by including an Option Strict On statement at the beginning of modules.

Implicit type conversions are limited to operations that are guaranteed not to lose information, such as converting from int to float:
int X = 0;
float Y = X; // OK

Other type conversions are performed explicitly by casts:
Y = 3.14F;
X = (int)Y; //Cast, OK.

Or, by using type conversion methods:
string Z;
Z = Y.ToString();

Comments

Comments always start with an apostrophe (‘):
‘ This is a comment.

There are three different types of comments: block (/* */), inline (//), and documentation (///):
/* Block comments can
span lines or be used
to comment out code. */
// Inline comments appear
// to the right of code.
/// < summary >Description
/// of class.< /summary >

For more information about documentation comments, see the "XML Documentation" topic in the Visual Studio online Help.

Arrays

 

 

 

 

 

 

 

Array elements are specified using
parentheses:
arrFruit(1) = "Apple"

Array elements are specified using square brackets:
arrFruit[1] = "Apple";

Methods

You can omit parentheses after method names if arguments are omitted:
strX = objX.ToString

You must include parentheses after all methods:
strX = objX.ToString();

Statement termination

Statements are terminated by carriage return:
Response.Write("Hello")

Statements are terminated by the semicolon (;):
Response.Write("Hello");

Statement continuation

Statements are continued using the underscore (_):
intX = System.Math.PI * _
intRadius

Statements continue until the semicolon (;) and can span multiple lines if needed:
intX = System.Math.PI *
intRadius;

String operator

Use the ampersand (&) or plus sign (+) to join strings:
strFruit = "Apples" & _
" Oranges"

Use the plus sign (+) to join strings: strFruit = "Apples" +
" Oranges";

Comparison operators

Use =, >, <, >=, < =, < > to compare values:
If intX >= 5 Then

Use ==, >, <, >=, < =, != to compare values:
if (intX >= 5)

Negation

Use the Not keyword to express logical negation:
If Not IsPostBack Then

Use the ! operator to express logical negation:
if (!IsPostBack)

Object comparison

Use the Is keyword to compare object variables:
If objX Is objY Then

Use == to compare object variables:
if (objX == objY)

Object existence

Use the Nothing keyword or the IsNothing function to check whether an object exists:
If IsNothing(objX) Then

Use the null keyword to check whether an object exists:
if (objX == null)

Apart from the above cited distinctions, there significant keyword usage differences in the two languages. The Visual studio.NET help topic titled “Language Equivalents” is directed towards assisting users attempting to understand or translate code from one language to another.

[catlist id=179].

Related posts