system.net

DNS Refresh Timeout with Mono

好久不见. 提交于 2019-12-22 17:40:41
问题 Although the current Mono project's ServicePointManager class has the DnsRefreshTimeout property enabled into its interface. The related property isn't implemented. Sample call: ServicePointManager.DnsRefreshTimeout = 10*60*1000; // 10 minutes When running my application I get the next exception on runtime: The requested feature is not implemented. (System.NotImplementedException) at System.Net.ServicePointManager.set_DnsRefreshTimeout (Int32 value) [0x00000] in /Developer/MonoTouch/Source

What does Dns.GetHostEntry Method(String) actually do?

纵然是瞬间 提交于 2019-12-21 12:01:34
问题 I can't find any proper description in the documentation for what this actually does. Does it check for the existence of A records or CNAME records or both? My understanding is that in .NET 4, this throws a SocketException if the host does not exist, and this is confirmed by my testing. 回答1: This is the list of addresses returned by var ips = System.Net.Dns.GetHostEntry("microsoft.com").AddressList; foreach (var ip in ips) Console.WriteLine(ip); // output 64.4.11.37 65.55.58.201 And these are

System.Net.WebClient fails weirdly

北战南征 提交于 2019-12-21 07:29:24
问题 I am trying to download some data from the reporting services instance on our TFS server. Given that the code should run on a computer that is not domain-joined, I figured that I would set the credentials myself. No luck, got a HTTP 401 Unauthorized back. Ok, so I hooked up Fiddler to see what was happening. But that's when I got Heisenberged - the call now went through without a hitch. So the authentication goes through with Fiddler connected, but fails without it. Is the Webclient broken or

System.Net.WebClient fails weirdly

旧街凉风 提交于 2019-12-21 07:29:07
问题 I am trying to download some data from the reporting services instance on our TFS server. Given that the code should run on a computer that is not domain-joined, I figured that I would set the credentials myself. No luck, got a HTTP 401 Unauthorized back. Ok, so I hooked up Fiddler to see what was happening. But that's when I got Heisenberged - the call now went through without a hitch. So the authentication goes through with Fiddler connected, but fails without it. Is the Webclient broken or

System.Net.Http NuGet package 4.3.0 reference generates System.IO.FileLoadException on System.Diagnostics.DiagnosticSource ver 4.0.0.0 reference

只谈情不闲聊 提交于 2019-12-21 07:04:53
问题 Description of the problem: A shared library "shared.dll" project references System.Net.Http NuGet package 4.3.0. The application that references "shared.dll" fails with System.IO.FileLoadException Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at System.Net

Access system.net settings from app.config programmatically in C#

若如初见. 提交于 2019-12-19 15:04:48
问题 I am trying to programmatically access a Windows application app.config file. In particular, I am trying to access the "system.net/mailSettings" The following code Configuration config = ConfigurationManager.OpenExeConfiguration(configFileName); MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup(@"system.net/mailSettings"); Console.WriteLine(settings.Smtp.DeliveryMethod.ToString()); Console.WriteLine("host: " + settings.Smtp.Network.Host + ""); Console

Access system.net settings from app.config programmatically in C#

萝らか妹 提交于 2019-12-19 15:01:02
问题 I am trying to programmatically access a Windows application app.config file. In particular, I am trying to access the "system.net/mailSettings" The following code Configuration config = ConfigurationManager.OpenExeConfiguration(configFileName); MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup(@"system.net/mailSettings"); Console.WriteLine(settings.Smtp.DeliveryMethod.ToString()); Console.WriteLine("host: " + settings.Smtp.Network.Host + ""); Console

Post multiple files and form values using .NET (console application)

余生长醉 提交于 2019-12-18 12:34:08
问题 I want to POST multiple files and form variables to a CGI script, all in one HTTP request. I believe this requires a HTTP post with multipart/form-data encoding. Here is a sample HTML form that sends the required information; I need to send the same information through the application: <form action="/process.php" enctype="multipart/form-data" method="post"> <input type="text" name="foo" value="bar"> <input type="text" name="blah" value="baz"> <input type="file" name="file1"> <input type="file

How do I clear System.Net client DNS cache?

╄→гoц情女王★ 提交于 2019-12-17 10:53:28
问题 I'm using the .NET WebRequest while changing my HOSTS file. I'm observing that System.Net doesn't honor those changes - how can I make it do so? I have a number of servers load-balanced behind a single hostname, let's say 'example.com'. I want to target several of them individually, so my program will hard-code the machine-specific IP address in my HOSTS file before sending a request to example.com: 163.56.0.34 example.com For the first server and first request, this works fine. Then my

How do I clear System.Net client DNS cache?

僤鯓⒐⒋嵵緔 提交于 2019-12-17 10:53:11
问题 I'm using the .NET WebRequest while changing my HOSTS file. I'm observing that System.Net doesn't honor those changes - how can I make it do so? I have a number of servers load-balanced behind a single hostname, let's say 'example.com'. I want to target several of them individually, so my program will hard-code the machine-specific IP address in my HOSTS file before sending a request to example.com: 163.56.0.34 example.com For the first server and first request, this works fine. Then my