Is it possible to access a profile without updating LastActivityDate?


In (using MVC, but this happens in regular too)


will update the LastActivityDate for that user. This is not intended when someone else is viewing that user's profile.

In the membership class you can specify whether to update this date with a second param, like so:

Membership.GetUser(username, false); // doesn't update LastActivityDate
Membership.GetUser(username, true); // updates LastActivityDate

Is there anyway to do something similar in the Profile provider without writing my own provider?

You might use one ugly workaround which includes changing aspnet_Profile_GetProperties stored procedure. This one is responsible for getting the properties while accessing user profile.

Open this procedure and you will find following code at the bottom:

    UPDATE dbo.aspnet_Users
    SET    LastActivityDate=@CurrentTimeUtc
    WHERE  UserId = @UserId

Remove it in order to stop updating the LastActivityDate. You will still get LastActivityDate updated when calling Membership.GetUser(username, true);.