Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2011, 10:51 AM
Authorized User
 
Join Date: Mar 2009
Posts: 64
Thanks: 0
Thanked 1 Time in 1 Post
Default Profile visibility

Imar,

In chapter 17 you discuss using the Profile in the .cs files to access the user's profile data. The Profile variable seems to be valid in other pages, but in my case it does not seem to "see" the data in the database.

I am trying to redirect the user to MyProfile.aspx after login if his or her profile is missing. In Login.aspx.cs I test Profile.FirstName == String.Empty. If false I redirect to the MyProfile.aspx page with a query string subsequently displayed asking the user to fill in his profile. But on Login.aspx.cs Profile.FirstName is always String.Empty and MyProfile.aspx has blank fields. Yet when I click directly to MyProfile.aspx the fields, i.e., the TextBoxes are filled in.

What am I missing?
 
Old January 14th, 2011, 03:40 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

The Profile object is not available (yet) in the Login page. In order to use the Profile you need to be logged in. Creating the Profile is done early in the page's life cycle and before the user logs in on the Login page. So, shortly after you log in, the Profile isn't there yet. Only on a subsequent request, when you're logged in, is the Profile created and available.

Take a look at the Practical Personalization Tips on page 651 for short tips of working around this.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Group visibility pushkar_joshi Reporting Services 0 September 3rd, 2010 09:58 AM
Codebehind for conditional visibility Nostromo77 ASP.NET 2.0 Basics 4 September 21st, 2008 08:00 PM
Chart Visibility baaul Reporting Services 1 September 28th, 2006 03:53 PM
Visibility Issue braheem ASP.NET 1.0 and 1.1 Basics 1 July 14th, 2005 05:20 PM
Procedure visibility rgerald Access VBA 6 December 10th, 2003 05:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.