c# - Why did Membership.GetUser().Email return the wrong value? -


i have mvc web application form posted ajax controller method starts out this:

[handleerror] [acceptverbs(httpverbs.post)] [authorize] public jsonresult formsubmitmethod (formcollection formcol) {     membershipuser myobject = membership.getuser();     guid currentuserid = (guid)myobject.provideruserkey; // correct guid     string emailaddress = myobject.email;  // incorrect email returned 1 time         ...and on 

i use guid provideruserkey data user , perform of regular updates etc. email address returned myobject.email used recipient address in confirmation email sent @ successful conclusion of regular transaction processing in controller method.

i understand perhaps should instead doing:

membershipuser myobject = membership.getuser(user.identity.name); 

and maybe problem.

this code has been running in production couple of years no reported problems , thousands of successful email confirmations sent. there no recent changes code.

this week had report received email controller method when intended else. trying sleuth out how happened. other facts , things know happened:

  1. the correct user name in iis logs expected, including on specific post request.
  2. the correct user data updated everywhere expect in database. conclude provideruserkey correct in unusual case.
  3. the email address returned membership.getuser().email valid email address user of site. have not logged in @ time -- has been months since last logged in.
  4. the 2 users in question have nothing each other. wasn't case forwarding emails or causing problem on side.
  5. the user logged in , should have received email brand new user. had newly registered account 10 minutes before above controller method invoked. posted other forms (not via ajax however) few minutes prior controller. other forms posted old-school webforms formviews.
  6. i using plain old forms authentication sql server provider.
  7. it feels red herring, both users happen share same first name, , unusual spelling of first name. last names , else different.

is plausible or expected membership.getuser().email return seemingly random user's email address rather of current logged in user? if why?


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -