新浪博客 http://upload.move.blog.sina.com.cn/blog_rebuild/blog/xmlrpc.php

网易博客 http://os.blog.163.com/api/xmlrpc/metaweblog/

自建Wordpress站点 http://您的博客地址/xmlrpc.php

博客园cnblogs 博客园 - 开发者的网上家园<您的用户名>/services/metaweblog.aspx

自建zBlog站点 http://your.zblog.site/xml-rpc/index.asp

CSDN博客官方已经禁用了API发布功能,此插件对CSDN博客已失效

端口:通常是80

用户名/密码:您的博客的用户名和密码

博客API:请选择MetaWeblog API。这是被绝大部分博客支持的API,包括新浪,网易,官方wordpress,自建的wordpress等等。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using LitJson;
using metaWeblogTest; public partial class ceshi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
M_MetaWeblog m_blog = new M_MetaWeblog();
//m_blog.Url = "http://www.cnblogs.com/webapi/services/metaweblog.aspx";//博客园
m_blog.Url = "http://upload.move.blog.sina.com.cn/blog_rebuild/blog/xmlrpc.php";//sina Post newPost = new Post();
newPost.dateCreated = DateTime.Now;
newPost.title = "发布测试1";
newPost.description = "发布测试1描述"; //string res=m_blog.newPost("id", "博客园用户名", "博客园密码", newPost, true);//博客园
string res = m_blog.newPost("id", "sina博客用户名", "sina博客密码", newPost, true);//sina
Response.Write(res); }
}

metaWeblogTest.cs源码

using System;
using CookComputing.XmlRpc; namespace metaWeblogTest
{ #region 微软MSN网站 使用的 MetaWeblog API.
/// 这个结构代表用户的博客基本信息
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct UserBlog
{
public string url;
public string blogid;
public string blogName;
} /// <summary>
/// 这个结构代表用户信息
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct UserInfo
{
public string url;
public string blogid;
public string blogName;
public string firstname;
public string lastname;
public string email;
public string nickname;
} /// <summary>
/// 这个结构代表博客分类信息
/// 这后面的getCategories()方法会取到CATEGORY数据。
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct Category
{
public string description;
public string title;
} /// <summary>
/// 这个结构代表博客( 文章 )信息。
/// 这后面的 editPost()方法, getRecentPosts()方法 和 getPost()方法 会取倒POST数据 .
/// </summary>
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct Post
{
public DateTime dateCreated;
public string description;
public string title;
public string postid;
public string[] categories;
}
#endregion #region 网站:http://msdn.microsoft.com/en-us/library/aa905670.aspx
///// <summary>
///// 微软MSN网站 使用的 MetaWeblog API.
//// 网站:http://msdn.microsoft.com/en-us/library/aa905670.aspx
///// </summary>
public class M_MetaWeblog : XmlRpcClientProtocol
{ /// <summary>
/// Returns the most recent draft and non-draft blog posts sorted in descending order by publish date.
/// </summary>
/// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="numberOfPosts"> The number of posts to return. The maximum value is 20. </param>
/// <returns></returns>
/// TODO:得到最近发布的帖子
[XmlRpcMethod("metaWeblog.getRecentPosts")]
public Post[] getRecentPosts(
string blogid,
string username,
string password,
int numberOfPosts)
{ return (Post[])this.Invoke("getRecentPosts", new object[] { blogid, username, password, numberOfPosts });
} /// <summary>
/// Posts a new entry to a blog.
/// </summary>
/// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="post"> A struct representing the content to update. </param>
/// <param name="publish"> If false, this is a draft post. </param>
/// <returns> The postid of the newly-created post. </returns>
/// TODO:增加一个最新的帖子
[XmlRpcMethod("metaWeblog.newPost")]
public string newPost(
string blogid,
string username,
string password,
Post content,
bool publish)
{ return (string)this.Invoke("newPost", new object[] { blogid, username, password, content, publish });
} /// <summary>
/// Edits an existing entry on a blog.
/// </summary>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="post"> A struct representing the content to update. </param>
/// <param name="publish"> If false, this is a draft post. </param>
/// <returns> Always returns true. </returns>
/// TODO:更新一个帖子
[XmlRpcMethod("metaWeblog.editPost")]
public bool editPost(
string postid,
string username,
string password,
Post content,
bool publish)
{ return (bool)this.Invoke("editPost", new object[] { postid, username, password, content, publish });
} /// <summary>
/// Deletes a post from the blog.
/// </summary>
/// <param name="appKey"> This value is ignored. </param>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <param name="post"> A struct representing the content to update. </param>
/// <param name="publish"> This value is ignored. </param>
/// <returns> Always returns true. </returns>
/// TODO:删除一个帖子
[XmlRpcMethod("blogger.deletePost")]
public bool deletePost(
string appKey,
string postid,
string username,
string password,
bool publish)
{ return (bool)this.Invoke("deletePost", new object[] { appKey, postid, username, password, publish });
} /// <summary>
/// Returns information about the user’s space. An empty array is returned if the user does not have a space.
/// </summary>
/// <param name="appKey"> This value is ignored. </param>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"></param>
/// <returns> An array of structs that represents each of the user’s blogs. The array will contain a maximum of one struct, since a user can only have a single space with a single blog. </returns>
/// TODO:得到用户的博客清单
[XmlRpcMethod("blogger.getUsersBlogs")]
public UserBlog[] getUsersBlogs(
string appKey,
string username,
string password)
{ return (UserBlog[])this.Invoke("getUsersBlogs", new object[] { appKey, username, password });
} /// <summary>
/// Returns basic user info (name, e-mail, userid, and so on).
/// </summary>
/// <param name="appKey"> This value is ignored. </param>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"></param>
/// <returns> A struct containing profile information about the user.
/// Each struct will contain the following fields: nickname, userid, url, e-mail,
/// lastname, and firstname. </returns>
/// TODO:得到用户信息
[XmlRpcMethod("blogger.getUserInfo")]
public UserInfo getUserInfo(
string appKey,
string username,
string password)
{ return (UserInfo)this.Invoke("getUserInfo", new object[] { appKey, username, password });
} /// <summary>
/// Returns a specific entry from a blog.
/// </summary>
/// <param name="postid"> The ID of the post to update. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <returns> Always returns true. </returns>
/// TODO:获取一个帖子
[XmlRpcMethod("metaWeblog.getPost")]
public Post getPost(
string postid,
string username,
string password)
{ return (Post)this.Invoke("getPost", new object[] { postid, username, password });
} /// <summary>
/// Returns the list of categories that have been used in the blog.
/// </summary>
/// <param name="blogid"> This should be the string MyBlog, which indicates that the post is being created in the user’s blog. </param>
/// <param name="username"> The name of the user’s space. </param>
/// <param name="password"> The user’s secret word. </param>
/// <returns> An array of structs that contains one struct for each category. Each category struct will contain a description field that contains the name of the category. </returns>
/// TODO:得到博客分类
[XmlRpcMethod("metaWeblog.getCategories")]
public Category[] getCategories(
string blogid,
string username,
string password)
{ return (Category[])this.Invoke("getCategories", new object[] { blogid, username, password });
}
}
#endregion
}

需要引用CookComputing.XmlRpcV2.dll

asp.net批量发布博客到各大博客平台的更多相关文章

  1. MWeb 1.3.7 发布!增加发布到 Wordpress 等支持 MetaWeblog API 的服务,如:Wordpress 博客、新浪博客、cnblogs、oschina。

    MWeb 1.3.7 版的新功能 增加发布到 Wordpress 等支持 Metaweblog API 的服务,目前经测试过的有: Wordpress 博客.新浪博客.cnblogs.oschina. ...

  2. Asp.Net MVC 进阶篇:路由匹配 实现博客路径 和文章路径

    Asp.Net MVC 进阶篇:路由匹配 实现博客路径 和文章路径 我们要实现 通过路由 匹配出 博客地址 和博客文章地址 例如下面的这两个地址 //http://www.cnblogs.com/ma ...

  3. ASP.NET 程序发布详细过程

    前言 ASP.NET网站的发布,无论是初学者还是高手,在程序的发布过程中或多或少会存在一些问题,譬如VS发布ASP.NET程序失败.IIS安装失败.IIS发布失败.局域网内不能访问 配置文件错误.权限 ...

  4. asp.net程序发布详解

    本文转载自Alan_beijing的博客ASP.NET 程序发布详细过程.内容进行了部分更改. ASP.NET网站的发布,无论是初学者还是高手,在程序的发布过程中或多或少会存在一些问题,譬如VS发布A ...

  5. 【ASP.NET MVC系列】浅谈ASP.NET 程序发布过程

    ASP.NET MVC系列文章 [01]浅谈Google Chrome浏览器(理论篇) [02]浅谈Google Chrome浏览器(操作篇)(上) [03]浅谈Google Chrome浏览器(操作 ...

  6. 转载 ASP.NET SignalR 与LayIM配合,轻松实现网站客服聊天室(一) 整理基础数据

    ASP.NET SignalR 与LayIM配合,轻松实现网站客服聊天室(一) 整理基础数据   最近碰巧发现一款比较好的Web即时通讯前端组件,layim,百度关键字即可,我下面要做的就是基于这个前 ...

  7. 自动发布-asp.net自动发布、IIS站点自动发布(集成SLB、配置管理、Jenkins)

    PS:概要.背景.结语都是日常“装X”,可以跳过直接看自动发布 环境:阿里云SLB.阿里云ECS.IIS7.0.Jenkins.Spring.Net 概要 公司一个项目从无到有,不仅仅是系统从无到有的 ...

  8. ASP.NET Core 发布至Linux生产环境 Ubuntu 系统

    ASP.NET Core 发布至Linux生产环境 Ubuntu 系统,之前跟大家讲解了 dotnet publish 发布,而没有将整个系统串起来. 今天就跟大家综合的讲一下ASP.NET Core ...

  9. 继网易博客后搜狐博客也增加了nofollow标签

    继网易博客后搜狐博客也增加了nofollow标签 今天在搜狐博客发表了篇文章,在末端添加上我的版权,结果回头查看是发现,这个锚文本被加上了nofollow标签,也就是说这样的外链已经没有传递权重的作用 ...

随机推荐

  1. 《C++Primer》复习——with C++11 [1]

    1.头文件中不应包含using声明,因为头文件的内容会拷贝到所有引用到他的文件中去,如果头文件里有谋个using声明,那么每个使用了该头文件的文件就会有这个声明,由于不经意间包含了一些名字,反而可能产 ...

  2. WinForm员工信息表

    先搞一个panel,然后里面放label.

  3. 【锋利的JQuery-学习笔记】Tab选项卡的实现

    效果图: 关键点: 1.标签和标签内容都是用<ul><li>实现的,主要是通过Css样式设计成选项卡的模样. 2.用js代码实现点击标签时,标签内容的切换(做法是<div ...

  4. String 内在分配解析

    1.String类概念 (1)String是final的,不可被继承.public final class String.String是的本质是字符数组char[], 并且其值不可改变.private ...

  5. hdu 2112 HDU Today (最短路,字符处理)

    题目 题目很简单,只是多了对地名转化为数字的处理,好吧,这我也是参考网上的处理办法,不过大多数的人采用map来处理 注意初始化注意范围,不然会wa!!!(这是我当时wa的原因org) 大家容易忽视的地 ...

  6. NSString+URLEncoding.h --使用Obj-C对数据等进行URLEncoding编码

    在Objective-c进行网络编程时,经常需要把数据转换成URLEncoding编码,如对+号编码后,变成%2b.这里我们给出一种实现. //NSString+URLEncoding.h #impo ...

  7. POJ 2407 Relatives(欧拉函数)

    题目链接 题意 : 求小于等于n中与n互质的数的个数. 思路 : 看数学的时候有一部分是将欧拉函数的,虽然我没怎么看懂,但是模板我记得了,所以直接套了一下模板. 这里是欧拉函数的简介. #includ ...

  8. lintcode: 二叉树的锯齿形层次遍历

    题目 二叉树的锯齿形层次遍历 给出一棵二叉树,返回其节点值的锯齿形层次遍历(先从左往右,下一层再从右往左,层与层之间交替进行) 样例 给出一棵二叉树 {3,9,20,#,#,15,7}, 3 / \ ...

  9. 对cost函数的概率解释

    Likehood函数即似然函数,是概率统计中经常用到的一种函数,其原理网上很容易找到,这里就不讲了.这篇博文主要讲解Likelihood对回归模型的Probabilistic interpretati ...

  10. 转载CSDN (MVC WebAPI 三层分布式框架开发)

    前言:SOA(面向服务的架构)是目前企业应用开发过程中普遍采用的技术,基于MVC WebAPI三层分布式框架开发,以此适用于企业信息系统的业务处理,是本文论述的重点.此外,插件技术的应用,富客户端JQ ...