【问题标题】:C# POST to Connect and disconnect 3g modemsC# POST 连接和断开 3g 调制解调器
【发布时间】:2021-04-18 18:23:17
【问题描述】:

大家好,我很难连接和断开调制解调器 3g,我通过 Fiddler 找到了 POST 请求的外观,但无法通过按钮下的 C# 使其工作。有人有经验吗? 我共享通过 Fiddler 嗅探的数据,希望有人知道如何修复它:(

// Connect
POST http://192.168.1.1/api/dialup/dial HTTP/1.1
Host: 192.168.1.1
Connection: keep-alive
Content-Length: 75
Accept: */*
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Origin: http://192.168.1.1
Referer: http://192.168.1.1/html/index.html
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,pl-PL;q=0.8,pl;q=0.7

<?xml version="1.0" encoding="UTF-8"?><request><Action>1</Action></request>

// Disconnect
POST http://192.168.1.1/api/dialup/dial HTTP/1.1
Host: 192.168.1.1
Connection: keep-alive
Content-Length: 75
Accept: */*
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Origin: http://192.168.1.1
Referer: http://192.168.1.1/html/index.html
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,pl-PL;q=0.8,pl;q=0.7


<?xml version="1.0" encoding="UTF-8"?><request><Action>0</Action></request>

【问题讨论】:

标签: c# fiddler


【解决方案1】:

好的,我找到了解决方案,也许有人会觉得它很有帮助

using (WebClient client = new WebClient())
            {
                client.Proxy = new WebProxy("192.168.100.19", 3128);


                byte[] request = client.UploadData("http://192.168.1.1/api/dialup/dial", "POST",
                Encoding.ASCII.GetBytes("<?xml version=\"1.0\" encoding=\"UTF - 8\"?><request><Action>1</Action></request>"));

                string final = Encoding.ASCII.GetString(request);
                textBox1.Text = final;

            }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 2012-07-31
    • 1970-01-01
    • 1970-01-01
    • 2011-12-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多