View Single Post
  #1 (permalink)  
Old July 18th, 2009, 02:40 PM
carewithl carewithl is offline
Authorized User
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default I've finally finished MEmbership and UserProfiling chapter, but I have a few question


Heh, I’ve completed the Membership and User profiling chapter ( I’ also learning Asp.Net as I go and that’s why it takes a bit longer ) and I have few questions ( I apologize if there are too many questions for a single thread, but I don't want to be spamming this forum with too many threads – if that’s a problem, please tell me )

BTW - The first four questions refer to ManageUsers Administrative Page ( page 170 )

1) I assume only reason why “SearchByEmail” and “SearchText” attributes need to be stored in ViewState ( and thus persisted across postbacks ) is for cases when administrator deletes a user and we want GridView to display same users (say those whose email name includes letter L ) as it displayed before page issued a posted back due to clicking a delete button?

2) lblTotUsers and lblOnlineUsers display a total number of registered users and a number of users currently online, respectively. The values assigned to these two labels are calculated only on first postback ( value for lblTotUsers is also calculated when user gets deleted ).

But shouldn’t values for lblTotUsers and lblOnlineUsers be calculated on each postback since new users could be created or logged in between the two concurrent postbacks?

3) I don’t see any point in setting Attribute[“SearchByEmail] inside rptAlphabet_ItemCommand() event handler, since “SearchByEmail” attribute will always be set and saved accordingly elsewhere?!

         bool searchByEmail = false;
       if ( !string.IsNullOrEmpty(gvwUsers.Attributes["SearchByEmail"]) )
               searchByEmail = bool.Parse(gvwUsers.Attributes["SearchByEmail"]);
This is most likely totally useless question, but why did we in above code set searchByEmail variable to false? Is it just a convention or…? As far as I can tell, gwsUsers.Attributes[“SearchByEmail”] will never be null or empty string, so I would think the following code would also work:

        bool searchByEmail;
        if ( !string.IsNullOrEmpty(gvwUsers.Attributes["SearchByEmail"]) )
                searchByEmail = bool.Parse(gvwUsers.Attributes["SearchByEmail"]);

Following code is featured on page 177 inside EditUser class:

public partial class class EditUser: BasePage
         protected void Page_Load(object sender, EventArgs e)
                 userName = this.Request.QueryString[“UserName”];
Is there a reason why in above code “UserName” parameter is extracted from query string on each postback and not just on first postback?

6) Register.aspx page ( page 159 ):

Inside CreateUserWizard control author has set both ContinueDestinationPageUrl and FinishDestinationPageUrl attributes to ~/Deafult.aspx. But I don’t see a point in setting ContinueDestinationPageUrl attribute, since as far as I can tell, user will never move to CompleteWizardStep due to WizardStep defined before CompleteWizardStep always redirecting user to Default.aspx page. Thus, I don’t even see a point in even declaring CompleteWizardStep in the first place?!

Thank you