Skip to Content
Beginning ASP.NET 3.5: In C# and VB
book

Beginning ASP.NET 3.5: In C# and VB

by Imar Spaanjaars
March 2008
Intermediate to advanced content levelIntermediate to advanced
766 pages
21h 15m
English
Wrox
Content preview from Beginning ASP.NET 3.5: In C# and VB

16.5. Exercises

  1. The favorite theme feature you created earlier would be a great candidate for a Profile property. What property would you need to add to the profile in web.config to make this possible?

  2. To set the favorite theme in the BasePage, you need to access the Profile in a special way. Instead of accessing the profile on the Page class, you access it through the HttpContext like this:

    VB.NET

    Dim myProfile As ProfileCommon = CType(HttpContext.Current.Profile, ProfileCommon)

    C#

    ProfileCommon myProfile = (ProfileCommon) HttpContext.Current.Profile;

    Given this code, how can you rewrite Page_PreInit so it gets the preferred theme from the Profile instead of from the cookie?

  3. What else do you need to change to finalize storing the theme in Profile instead of a custom cookie?

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET 4: in C# and VB

Beginning ASP.NET 4: in C# and VB

Imar Spaanjaars
Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Professional ASP.NET 3.5 SP1 Edition: In C# and VB

Bill Evjen, Scott Hanselman, Devin Rader

Publisher Resources

ISBN: 9780470187593Purchase book