0

我正在开发 MVC4 应用程序,我想使用 windows live id 对我的应用程序进行身份验证。我已经开发了可以邀请用户的页面,所以我想检查用户的电子邮件 id 是否是 windows live id?

我尝试了不同的方法,但它们只是在验证电子邮件 ID 是否为 gmail id。

我试过下面的代码。但它适用于 Gmail,不适用于 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();

还有其他方法可以实现吗?

4

1 回答 1

0

这取决于您选择如何验证您的用户。如果您使用 Microsoft 应用 2.0 进行身份验证,则真实帐户具有“9188040d-6c67-4c5b-b112-36a304b66dad”的“tid”声明,而工作或学校帐户具有唯一的“tid”声明。

您还可以查看此问题以获取更多信息:如何确定电子邮件地址是 Microsoft“工作或学校”帐户还是 Microsoft 帐户

于 2016-06-28T13:05:32.867 回答