Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7673255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:28:14+00:00 2026-05-31T16:28:14+00:00

So I am fairly new to ASP.NET MVC and Windows Live Connect API. Basically

  • 0

So I am fairly new to ASP.NET MVC and Windows Live Connect API. Basically I am trying to integrate Live sign in into my website. When users sign in, Live requests their permission to give my app certain info, sends the user to a redirect uri specified in my app settings appended with a querystring. Here, if the user is signing into the site for the first time, I want their basic info stored on my server (first name, last name, email). I have been able to get their first and last name, but am having a hard time finding out how to retrieve their primary email address. I’ll explain what I’ve done so far.

I couldn’t find the best way to integrate Live connect into an MVC app so I took my best guess. I specified a controller action in my redirect uri that takes the querystring “code” to construct an HTTP Post.

HttpRequest req = System.Web.HttpContext.Current.Request;

            string myAuthCode = req.QueryString["code"];
            string myAppId = ConfigurationManager.AppSettings.Get("wll_appid");
            string mySecret = ConfigurationManager.AppSettings.Get("wll_secret");
            string postData = "client_id=" + myAppId + "&redirect_uri=http%3A%2F%2Fmscontestplatformtest.com%2FContestPlatform%2FUser%2FSignIn&client_secret=" + mySecret + "&code=" + myAuthCode + "&grant_type=authorization_code";

            byte[] byteArray = Encoding.UTF8.GetBytes(postData);

            WebRequest request = WebRequest.Create("https://oauth.live.com/token");
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = byteArray.Length;
            request.Method = "POST";

Get the JSON-formatted string response and extract the access_token. Then I use this access token to construct an HTTP GET call as follows.

request = WebRequest.Create("https://apis.live.net/v5.0/me?access_token=" + r.access_token);
            response = request.GetResponse();
            reader = new StreamReader(response.GetResponseStream());

            string userInfo = reader.ReadToEnd(); 

The GET call above provides me with this JSON string:

{ 
    "id": "02b4b930697bbea1", 
    "name": "Daniel Hines", 
    "first_name": "Daniel", 
    "last_name": "Hines", 
    "link": "http://profile.live.com/cid-02b4b930697bbea1/", 
    "gender": "male", 
    "locale": "en_US", 
    "updated_time": "2011-10-14T21:40:38+0000" 
} 

Which is all public info and is great, I have almost everything I need except their primary email address. What sort of GET call do I need to retrieve email?

Also, am I doing this right way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:28:16+00:00Added an answer on May 31, 2026 at 4:28 pm

    Ok I figured it out!

    I just needed to add the scope “wl.emails” to my sign in link. Then my GET call will return their email addresses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to ASP.NET MVC, and I'm having a little trouble with scripts...
I am fairly new at using the ASP.NET MVC framework and was hoping that
I'm fairly new to ASP.NET and trying to learn how things are done. I
I'm fairly new to ASP.NET MVC and I've got a problem with Html.TextBoxFor() -
Fairly new to asp.net Mvc and jquery. Have the following code working fine, but
I'm fairly new to ASP.Net MVC and I find myself making a single model
I'm fairly new to ASP.NET MVC and jQuery. I've got a jQuery UI datepicker
I'm trying to integrate NHibernate.Validator with ASP.NET MVC client side validations, and the only
I'm fairly new to ASP.NET MVC and am looking for help with the following
I'm fairly new to ASP.NET MVC and am not sure how best to handle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.