Realization principle and ASP.net code of TrackBack

Source: Internet
Author: User
Trackback Ping, one of the three features of the so-called blog, does not have a real specification on the web, it is actually the first technology invented in moveable and started to use, compared with the other two RSS and permalink which are widely regarded as the main features of the blog , RSS is essentially an XML format that follows the universal RDF specification, and permalink is a very generic static address technology, and trackback Ping has so far only been used in the blogging process, except for a moveable technical specification document. There is no authoritative standards, especially in the domestic, many blog programs some support some do not support, some limited support, and even because of inconsistent standards and can not communicate with each other (see "Blog Is Dead (blog dead)" http://blog.igooi.com/ archive/2005/10/28/6716.aspx).

But as a developer, we don't have to discuss or debate whether trackback is dead, whether it will bring malicious spam these issues, like the existence of spam, does not affect the technical progress and use of e-mail. For developers, since Trackback is considered to be one of the three major technologies of blogging, and the user of the blog program has this kind of demand, then we should include this technology when we develop the blog. Moreover, we should try to make the technology we develop conform to the standard, or the specification, at least let it work.

Trackback Ping is a specification invented by moveable type, so before we have more authoritative standards, we should use this technique, of course, with their specifications, here is their Trackback Technical Specification document: http:// Www.movabletype.org/docs/mttrackback.html.

The full implementation of Trackback includes at least two aspects, one: The client sends Trackback ping; second, the server receives and processes the trackback ping and returns processing results to the client. Then, depending on your needs, we can consider receiving or not receiving, processing, or not processing the returned information on the client. The following is the specific code:/**////: Sends a trackback Ping to the specified URL and prompts the user to handle the situation based on the information returned on the server side. Parameter must be Server.URLEncode
The destination URL, which is the reference address provided by the referenced blog
The URL of my blog
Name of my blog site
The title of the current blog
The summary of the current blog
Return result: String, with "|" Divided, the first part is a number, 0 for success, 1 for errors; the second part is specific information.
public static int Send (string remoteurl, String Myblogurl, String myblogname, String myblogtitle, String my BLOGEXCERPT)
... {
' Constructs the requested content to be sent
Try
... {
String strpostinfo = "title=" + myblogtitle;
Strpostinfo + = "&url=" + myblogurl;
Strpostinfo + = "&excerpt=" + myblogexcerpt;
Strpostinfo + = "&blog_name=" + myblogname;

byte[] STRs = System.Text.Encoding.Default.GetBytes (Strpostinfo);

HttpWebRequest myrequest = (HttpWebRequest) webrequest.create (Remoteurl);

Myrequest.method = "POST";
Myrequest.contenttype = "application/x-www-form-urlencoded";
Myrequest.contentlength = STRs. Length;
Stream newstream = Myrequest.getrequeststream ();
Send data
Newstream.write (STRs, 0, STRs. Length);
Newstream.close ();
return 1;
}
catch (System.Exception es)
... {
return 0;
}
}

Related Article

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.