Quantcast
Channel: Claims based access platform (CBA), code-named Geneva forum
Viewing all articles
Browse latest Browse all 2535

Making requests using WebClient and security tokens

$
0
0

Hi all,

I was wondering if it is at all possible to use the WebClient (or a similary approach) to make requests to a resource protected by WIF (.aspx page, web service, etc)?

Using the WebClient, I'm able to get a response from a (custom) STS containing the security token like so;

WebClient client = new WebClient();            
client.Credentials = new NetworkCredential("user", "password");
var resp = client.DownloadString("http://localhost:40202/?wa=wsignin1.0&wtrealm=http://localhost:51574&wctx=rm=0&id=passive&ru=%2fDefault.aspx&wct=2012-09-11T09:36:09Z HTTP/1.1");


I can parse the response as XML and get whatever I need.

The question is, how can I (if possible) use that data to make a web request to a resource protected by WIF?

I'm thinking it should be possible to do something like;

WebClient client = new WebClient();
client.Headers.Add(headername,token_value);
client.DownloadString("http://abc.com/someresource");

but I'm not able to get it to work. When making the request, I get a 401 Unauthorized.

Anyone know if this is possible or if I'm doing this all wrong?

-Thanks!


Viewing all articles
Browse latest Browse all 2535


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>