Membership.GetUser() does not work for a specific user RRS feed

  • Question

  • User-312760255 posted


    I am facing a strange issue that I cannot find information on anywhere that matches my specific problem.  Some background information:

    We are running an ASP.Net site through IIS, connecting to and MSSQL 2012 server on an Azure VM.

    So, the issue is that for one specific user our password change page is throwing a server error because Membership.GetUser() is returning a null.  We are using the string override to pass the user's username to it.

    I have already verified that the string being passed is correct, that the user does exist in our aspnet_Users table, that there is also a aspnet_Membership record for that user's UserID, and that when I am on our password reset page that I am an authenticated user.

    While on this page and debugging the VB code behind in Visual Studio I can call Membership.GetUser() directly and pass through any number of other users and their user information is returned in the Watch window but when I try to do this with the user who we are facing this issue with the function returns Nothing instead of a Membership object.

    We don't know where to go from here because the user exists in the right places in the database and the page works for other usernames, just not this one.

    Please let me know if you need any code or any other information.


    Thursday, September 6, 2018 8:23 PM

All replies

  • User-312760255 posted

    I was able to solve this on my own.  The problem was caused by a really weird issue in the database.  At some point, somehow the user's ID was changed to a second account that was created for him in the membership table.  Not sure why this was causing the function to return a null as the username was correct and the linkage to the membership record was also there but when I set it back to his previous account the function returned his user membership record correctly and the password reset page did not crash.

    If someone can explain why this happened, I will mark it as the answer.

    Thursday, September 6, 2018 9:27 PM
  • User1724605321 posted

    Hi Geowil ,

    You can use SQL Server Profiler to trace at which point "the user's ID was changed to a second account that was created for him in the membership table" ,  which may help you find out the reason and prevent the behavior :


    Best Regards,

    Nan Yu

    Wednesday, September 19, 2018 6:54 AM