Created
January 28, 2013 13:26
-
-
Save aliostad/4655476 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Security.Claims; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Web.Http; | |
namespace Mvc4Application2.Controllers | |
{ | |
public class ValuesController : ApiController | |
{ | |
// GET api/values | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "value1", "value2" }; | |
} | |
// GET api/values/5 | |
public string Get(int id) | |
{ | |
return "value"; | |
} | |
public async Task<string> GetAsync(int id, string name) | |
{ | |
Thread.CurrentPrincipal = new ClaimsPrincipal(); | |
var cl = new HttpClient(); | |
HttpResponseMessage res = await cl.GetAsync("http://google.com"); | |
string s = await res.Content.ReadAsStringAsync(); | |
var p = Thread.CurrentPrincipal; // THIS IS GENERIC principal!!!! | |
return s; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment