locked
null value for current user RRS feed

  • Question

  • Hi

    I have a site using azure AD and somehow the username is returning null, when trying to insert a new user into the database.

    I have a call to insert a user into the database when a session starts, and I gathered the username using HttpContext.Current.User.Identity.Name, this worked when testing on IIS express and on IIS.

    When i moved the site to azure, after logging in, I get the error that a null value cannot be inserted into the database. If i remove that call the site loads fine, with my user name displayed on the page, any idea why the website wont be picking up the username initially, but displays it if i don't send the name to the database?

    Thank you

    Sasha

    Wednesday, April 2, 2014 11:49 AM

All replies

  • Hi,
    It seems like this issue was more related with Microsoft Azure Directory, I will move this thread to Microsoft Azure Directory Forum for a better help.
    Thank you for your understanding.

    Best Regards


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, April 3, 2014 2:54 AM
  • How exactly is it using Azure AD? With WIF, with ADAL? 

    Developer Security MVP | www.syfuhs.net

    Thursday, April 3, 2014 2:58 PM
  • Hi

    not using WIF, i used the following tutorial:

    http://msdn.microsoft.com/library/azure/dn151790.aspx

    As I said, i am able to login, but this line "HttpContext.Current.User.Identity.Name" seems to be returning a null, as I pass the value from the above line to a function to check if the user exists or not, and if not to add it to the database.

    Sasha

    Friday, April 4, 2014 7:58 AM