小编Ale*_*dro的帖子

在Windows Phone 8.1上添加防火墙规则

我真的不知道如何寻找我想要实现的目标.我将添加两张图片,以更好的方式向您展示我在这里所做的事情.

在此输入图像描述

在此输入图像描述

正如您所看到的,我在防火墙中添加了一个阻止规则,该规则将阻止特定应用程序的一系列地址(第二个图像的第一个规则).

有没有办法在Windows手机上做类似的事情?我不是在寻找一些代码或任何东西.只是为了一些指导.我应该在哪里看?我应该寻找什么?Windows手机没有防火墙,我不想使用任何外部防火墙应用程序,如果有...

c# firewall ip-address windows-phone-8.1

13
推荐指数
1
解决办法
629
查看次数

HttpClient ReadAsStringAsync 有进度

有没有办法获取ReadAsStringAsync()方法的进度?我只是获取网站的 HTML 内容并进行解析。

public static async Task<returnType> GetStartup(string url = "http://")
{
    using (HttpClient client = new HttpClient())
    {
        client.DefaultRequestHeaders.Add("User-Agent",
            "Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko");
        using (HttpResponseMessage response = await client.GetAsync(url))
        {
            using (HttpContent content = response.Content)
            {
                string result = await content.ReadAsStringAsync();
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# asynchronous stream httpclient async-await

4
推荐指数
1
解决办法
2047
查看次数

C# HttpClient 在字典字符串/对象中使用 FormUrlEncodedContent 对象发布内容

我正在尝试将内容发布到我的服务器。这就是我过去一直这样做的方式,直到我不得不使用字符串以外的对象为止。

using (HttpClient client = new HttpClient())
{
    client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(authType, tokens);
    var postParams = new Dictionary<string, object>();

    postParams.Add("string", string);
    postParams.Add("int", string);
    postParams.Add("datetime", DateTime);
    postParams.Add("datetime", DateTime);
    postParams.Add("Match", Match);
    postParams.Add("TicketId", token);

    using (var postContent = new FormUrlEncodedContent(postParams.ToDictionary()))
    {
        var myContent = JsonConvert.SerializeObject(postParams);
        var buffer = System.Text.Encoding.UTF8.GetBytes(myContent);
        var byteContent = new ByteArrayContent(buffer);
        byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

        using (HttpResponseMessage response = await client.PostAsync(@"http://url/api", byteContent))
        {
            response.EnsureSuccessStatusCode(); // Throw if httpcode is an error
            using (HttpContent content = response.Content)
            {
                string result = …
Run Code Online (Sandbox Code Playgroud)

c# encoding json http httpclient

3
推荐指数
1
解决办法
8341
查看次数