Skip to content

Instantly share code, notes, and snippets.

using (var client = new HttpClient())
{
var values = new List<KeyValuePair<string, string>>();
values.Add(new KeyValuePair<string, int>("n", "42"));
values.Add(new KeyValuePair<string, string>("s", "string value"));
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("http://www.domain.org/receiver.aspx", content);
static WebRequest request;
private static void sendAndReceive()
{
// The request with a big timeout for receiving large amout of data
request = HttpWebRequest.Create("http://localhost:8081/index/");
request.Timeout = 100000;
// The connection timeout
var ConnectionTimeoutTime = 100;
Timer timer = new Timer(ConnectionTimeoutTime);
'use strict';
window.COB = window.COB || {};
window.COB.HostWebApp = function() {
var hostWebUrl, appWebUrl, hostWebContext, errorOccured=false;
/*
* Init hostWebUrl and hostWebContext
*/
@ludo6577
ludo6577 / Window Close.js
Last active August 29, 2015 14:11
Javascript: Open / Close window
function close_popupWindow() {
window.self.opener = window.self;
window.self.close();
}
@ludo6577
ludo6577 / Facebook .js
Last active August 29, 2015 14:07
Javascript: Connect to facebook (need to set FB_APPID first !)
/*
* FACEBOOK Loading
*/
window.fbAsyncInit = function () {
FB.init({
appId: FB_APPID,
fileUpload: true,
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse social plugins on this page