Dottext 3 optimization: improved trackback

Source: Internet
Author: User

Trackback is an important function of blog.ArticleTrackback is about to die. I think the biggest obstacle to trackback is the standard issue. Many blog sites do not comply with trackback standards (standard content http://www.movabletype.org/docs/mttrackback.html)

In China, even the http://www.blogchinese.com, http://www.bokee.com/this kind of large network sites do not comply with this standard, trackbackapplication is not smooth is also of course.

Fortunately, dottext complies with this standard and the related classes are:

Dottext. Framework. Tracking. trackbacknotificationproxy: Send trackback

Dottext. Framework. Tracking. trackbackhandler: receives the ping trackbac.

In cnblogsdottext10beta2, The trackback function is blocked, probably because many people encounter an error when submitting a posts containing a reference link after successful installation:

Truncates string or binary data.

In fact, this is because the key method for sending trackback: sendping (string trackbackitem, string parameters) sends byte streams according to the length of the ASCII code. When parameters contains Chinese characters, there will be errors, the solution is to convert to UTF-8 to send, below is my modifiedCode:

Private void sendping (string trackbackitem, string parameters)
{

Httpwebrequest request = blogrequest. createrequest (trackbackitem );
Request. method = "Post ";

Request. contenttype = "application/X-WWW-form-urlencoded ";
Request. keepalive = false;

Byte [] buff = encoding. getencoding ("UTF-8"). getbytes (parameters );

Request. contentlength = buff. length;

Stream reqstream = NULL;
Try
{
Reqstream = request. getrequeststream ();

Reqstream. Write (buff, 0, Buff. Length );
}
Catch (exception E)
{
Logger. logmanager. createexceptionlog (E, "sendping exception ");
}
Finally
{
Reqstream. Close ();
}

In the next section, I will analyze the process of dottext in trackback and provide some suggestions for improvement methods.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.