середа, 10 листопада 2010 р.

Call webservice with basic auth


var srv = new SalersService();
srv.Credentials = new NetworkCredential("[user]", "[pass]");
...

Call webservice via proxy


var srv = new SalersService();
var proxy = new WebProxy("[url]", [port]);
proxy.Credentials = new NetworkCredential("[user]", "[pass]", "[domain]");
srv.Proxy = proxy;
...

понеділок, 1 листопада 2010 р.

Кириллица в куках

Можно использовать UrlEncode, UrlDecode:

var cookie = new HttpCookie("user", Server.UrlEncode(name));
...
var name = Server.UrlDecode(cookie.Value);

вівторок, 26 жовтня 2010 р.

Cool Player

Нашел крутой плеер




пʼятниця, 15 жовтня 2010 р.

четвер, 14 жовтня 2010 р.

Write to appSettings


System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["LastMsgID"].Value = value.ToString();
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");

WPF & Thread.CurrentPrincipal


так неправильно:

System.Threading.Thread.CurrentPrincipal = [YourPrincipal];

так правильно:

AppDomain.CurrentDomain.SetThreadPrincipal([YourPrincipal]);