Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

webservice renew Token

Status
Not open for further replies.

csupriest

Programmer
Jan 25, 2006
5
US
How do I renew a token. I want to use HttpWebrequest. Here is what I have so far


public override void PreExecute()
{
string Url = "
string data = "code={0}&client_id={1}&client_secret={2}&refresh_token={3}&grant_type=refresh_token";
HttpWebRequest request = HttpWebRequest.Create(Url) as HttpWebRequest;
string result = null;
request.Method = "POST";
request.KeepAlive = true;
request.ContentType = "application/x-
string param = string.Format(data, "" , "");
var bs = Encoding.UTF8.GetBytes(param);

using (Stream reqStream = request.GetRequestStream())

{
reqStream.Write(bs, 0, bs.Length);
}

using (WebResponse response = request.GetResponse())

{

var sr = new StreamReader(response.GetResponseStream());

result = sr.ReadToEnd();

sr.Close();

}


}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top