Is it possible to access a profile without updating LastActivityDate?

前端 未结 2 675
暖寄归人
暖寄归人 2021-01-04 09:29

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

Profile.GetProfile(username);

will update the LastActivityDate for that user. This

2条回答
  •  悲&欢浪女
    2021-01-04 09:50

    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:

    IF (@@ROWCOUNT > 0)
    BEGIN
        UPDATE dbo.aspnet_Users
        SET    LastActivityDate=@CurrentTimeUtc
        WHERE  UserId = @UserId
    END
    

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

提交回复
热议问题