BTI420 notes Tue Jan 24 – lecture

Topic coverage will include state persistence. This is the first of three techniques that we will learn over the next few weeks. We will also introduce collection classes.


Prepare for today’s class

Textbook readings:

Beginning ASP.NET 4 in C# and VB
Chapter 4, 5
ASP.NET 4 Unleashed
Chapter 28


Coming up in BTI420

Thu Jan 26 – Test 1, both periods, written test, in S3007

Tue Jan 31 – security introduction, using the server’s file system, System.IO classes


Code examples for today

Simple Session State

Collection Array

Collection Generic List


Topic coverage in today’s lecture

Discussion about BTI420 Lab 2

Discussion about BTI420 Test 1


In a web app, you can use three techniques to persist state:

  1. Web app state persistence
  2. File system storage
  3. Data store persistence (e.g. database server, web services)


Today, we will learn about the first technique, web app state persistence. Next lecture, we will work with file system storage. Then, the following week, we work with data store persistence, using Microsoft SQL Server.

Here’s what you can expect today:

You will learn a simple, yet powerful, and recommended technique, “session state” persistence.

Then, we will cover a number of web app life cycle topics, which are important. Some will review and enhance previous coverage (in BTI320), while other topics may be new to you.

Finally, we introduce collections, with coverage of the array and generic list.


Avoiding session state errors

In the MSDN “how to“, it has these important points:

No exception is thrown if you attempt to get a value out of session state that does not exist.

If you attempt to use a nonexistent session state entry in some other way, an exception is thrown.

Session values are of type Object. In C#, you must cast to the appropriate type when reading session values.


Notes and reference information:

State persistence introduction for ASP.NET Web Forms apps

Collections for new ASP.NET Web Forms programmers





  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 48 other followers

%d bloggers like this: