0

I am developing MVC4 application and i want to authenticate my application using windows live id. I have developed page where i can invite users, so i want to check if user's email id is windows live id or not?

I have tried different things, but they are just validating whether email id is gmail id or not.

I have tried below code. but it is working for Gmail, not for windows live id

            TcpClient tClient = new TcpClient("gmail-smtp-in.l.google.com", 25);
            string CRLF = "\r\n";
            byte[] dataBuffer;
            string ResponseString;
            NetworkStream netStream = tClient.GetStream();
            StreamReader reader = new StreamReader(netStream);
            ResponseString = reader.ReadLine();
            /* Perform HELO to SMTP Server and get Response */
            dataBuffer = BytesFromString("HELO KirtanHere" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            ResponseString = reader.ReadLine();
            dataBuffer = BytesFromString("MAIL FROM:<YourGmailIDHere@gmail.com>" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            ResponseString = reader.ReadLine();
            /* Read Response of the RCPT TO Message to know from google if it exist or not */
            dataBuffer = BytesFromString("RCPT TO:<" + email.Trim() + ">" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            ResponseString = reader.ReadLine();
            if (GetResponseCode(ResponseString) == 550)
            {
                IsExist = false;
                //Response.Write("Mai Address Does not Exist !<br/><br/>");
                //Response.Write("<B><font color='red'>Original Error from Smtp Server :</font></b>" + ResponseString);
            }
            /* QUITE CONNECTION */
            dataBuffer = BytesFromString("QUITE" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            tClient.Close();

Is there any other way i can achieve this?

User5590
  • 1,383
  • 6
  • 26
  • 61

1 Answers1

0

It depends on how you choose to authenticate your users. If you are using Microsoft apps 2.0 for authentication a live account has a 'tid' claim of ""9188040d-6c67-4c5b-b112-36a304b66dad" while work or school accounts have unique 'tid' claims.

You can also view this question for more information: How to determine if an email address is a Microsoft 'Work or School' account or a Microsoft Account

Community
  • 1
  • 1
John Ruf
  • 165
  • 1
  • 10