在 C# 中提交关于 Pastie 或 pastebin 的帖子

cod*_*mst 1 c# post http pastie

我正在寻找一种方法来从我的 C# 应用程序中向 Pastie.org 或 pastebin.com 提交帖子,我知道我必须使用某种 http 帖子,但我正在寻找具体示例。

Tho*_*que 6

我刚刚用 C#编写了一个简单的PasteBin 客户端

您可以按如下方式使用它:

        string apiKey = "<your api key>";
        var client = new PasteBinClient(apiKey);

        // Optional; will publish as a guest if not logged in
        client.Login(userName, password);

        var entry = new PasteBinEntry
            {
                Title = "PasteBin client test",
                Text = "Console.WriteLine(\"Hello PasteBin\");",
                Expiration = PasteBinExpiration.OneDay,
                Private = true,
                Format = "csharp"
            };

        string pasteUrl = client.Paste(entry);
        Console.WriteLine("Your paste is published at this URL: " + pasteUrl);
Run Code Online (Sandbox Code Playgroud)

您可以在此页面上获取您的 API 密钥(您需要登录)。