This documentation is archived and is not being maintained.

Code for Web Applications

Visual Studio .NET 2003

This topic is designed to help you find code that demonstrates how to perform common programming tasks in Web applications using Visual Basic .NET.

Note   For tasks that pertain to Web Forms controls specifically, see Code for Web Forms Controls.

The following categories are represented in the list below:

You can also find sample code for Web applications in the following locations:

Page Programming

Example of...

Creating a simple Web Forms page

Redirect users to another page

Passing information from one page to another

Detecting what browser the user has

Reading the query string passed in the URL

Event Handling

Example of...

Basic event handling for Web server controls

Creating event handlers at run time

Binding an existing method to an event

Handling an event in both client script and server code

Handling multiple events with the same event handler

Handling an event globally

Accessing Data

Example of...

Simple data access

Accessing read-only data

Caching datasets between round trips

Data-binding individual controls

Updating a database

Using a grid to read and write data

Displaying paged data

Defining a data source dynamically

Data-binding a list control (ListBox, DropDownList, etc)

Data-binding HTML server controls using HTML syntax

Data-binding controls at run time

Managing State

Example of...

Saving information in viewstate in the page

Sharing values in Session state

Saving a dataset in Session state

Error Handling

Example of...

Basic error handling

Creating a global error handler


Example of...

Using HTML encoding to guard against malicious data

Filtering HTML elements out of user input

Allowing only predetermined characters in user input

Guarding against unhandled exceptions

Passing credentials to a database in a connection string

Storing information in the Windows registry on the server

XML Web Services

Example of...

Creating a simple XML Web service

Creating a simple application that consumes an XML Web service

Creating a simple XML Web service accessed from a Windows Form

Creating a simple distributed application using an XML Web service

Declaring an XML Web service

Inheriting from the base WebService class

Defining XML Web service methods

Exposing an XML Web service methods

Accessing an XML Web service

Accessing an XML Web Service asynchronously

Related Code Examples

Code for Data Access

Code Examples for Visual Basic Programmers