Take the 2-minute tour ×

I am working in ASP.NET MVC3. When a user complete registration, I want to notify user to change personal information only in first lo-gin. How can I do it?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

You can always create a new variable to check if this is the user's first login, but that variable would become unused after the first login.

I assume you have a DateTime variable for UserLastLoggedin or something along those lines? If that is null, then the user is logging in for the first time.

share|improve this answer
I like this approach ^^ –  Viper Dec 2 '11 at 10:40
It's the least intrusive way I know, and most likely, your system is already implementing this, you just need to know when to check it. –  Flater Dec 2 '11 at 10:43

If a user completes your registration process you need to store a value which indicates that he doesn't have changed his personal information yet.

Something like

isNewUser = true;
share|improve this answer

There are several ways to accomplish that. You can utilize Profiles, or create a table in your database where you can store userId along with an indicator if he's logging in for the first time or not.

Let's say you want to use profiles : add this to you web.config

    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
    <add name="EverLoggedOn" defaultValue="False" type="System.Boolean" />

If you're using default AccountController take a look at this code :

            if (Membership.ValidateUser(model.UserName, model.Password))

                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);

                if (Roles.IsUserInRole(model.UserName, "Administrator"))
                    return RedirectToAction("Index", "ManageApp");
                var userProfile = ProfileBase.Create(model.UserName);
                var FirstTime = userProfile.GetPropertyValue("EverLoggedOn");
// rest of the code is up to you :)
share|improve this answer

Your Answer


