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
|Beginning ASP.NET 4 in C# and VB
Chapter 4, 5
|ASP.NET 4 Unleashed
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 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:
- Web app state persistence
- File system storage
- 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: