Wednesday, December 20, 2006

Runnning ASP.1.1 and ASP.NET 2.0 in IIS 6.0

Since it is not possible to run both ASP.1.1 and ASP.NET 2.0 in the same application pool, create a new application pool for .NET 20 applications and set the web site's application pool (Properties->Home Directory->Application Pool) to the new pool created. Do not forget to set (Properties->ASP.NET->ASP.NET version) the's version to 2.0!

Wednesday, December 13, 2006

MovableType, XMLRPC, ATOM

Atom Api Spec:

Typed Atom API:

Six Apart Atom Centre:

Rss Vs Atom

Atom Api in Movable Types:

Movable Type Developer Centre:


Atom Api Urls
To get the list of services sens a get request on the following URL:

This will give you a response in a similar format as below. For each blog set up on the server similar informarion will be returned.

<feed xmlns="">
<link xmlns="" type="application/x.atom+xml" rel="" href="" title="YOUR BLOG'S TITLE #8" />
<link xmlns="" type="application/x.atom+xml" rel="service.feed" href="" title="YOUR BLOG'S TITLE #8" />
<link xmlns="" type="application/x.atom+xml" rel="service.upload" href="" title="YOUR BLOG'S TITLE #8" />
<link xmlns="" type="application/x.atom+xml" rel="service.categories" href="" title="YOUR BLOG'S TITLE #8" />
<link xmlns="" type="text/html" rel="alternate" href="" title="YOUR BLOG'S TITLE #8" />

Each link returned in the response is actually a URL of another request. The response above gives us five different links for a blog which has an ID of 8. rel attrubute gives the information about the URL. The URL of the blog from where users can see it is given in the alternate link.

If you want to post something using the API then use the URL in the item which has "" rel attribute
If you want to retrieve data using the API then use the URL in the item which has "service.feed" rel attribute
To get the blog data:
As a default it will be returning the blog and its most recent 20 posts. The data is returned in a feed node having posts in entry tags. To diffrentiate the published and unpublisged posts, check the draft nodes inside each entries. If the entry is not published this node exists and its value becomes 'true'. If the entry is published, you may not be able to find it in the server's response.
Everything has a URL in Atom Api.
To get a specific post's data with the ID of 80 send a GET request on the following URL.
The data will be returned in one entry node.
To get the list of categories:
If you want to retrieve the list of categories using the API then use the URL in the item which has "service.categories" rel attribute.

While the username and password is sent in plain text using xmlrpc, it has to be sent encrypted in Atom Api. They do not use the logon password which you use it to logon to Movabletype. If you scroll down to Password section and to the bottom, you will see another password which is called "web services password". You will be using this password in both Apis and your username as you logon to Movabletype. Another problem is, instead of Author's display name, the username is returned inside an Entry node in Atom Api. It also returns the url and the email of the author. But in XmlRpc, there is no way to get the user details. You can only retrieve the details by providing the user's username and password. The other problem is, it returns the id, not even the username!! In XmlRpc there us no option to filter the unpublished posts. While it is very easy to get the most recent posts using XmlRpc, I could not find a way using Atom Api. Working on it!!!

If you want to implement those APIs, start by looking to Atomizer and Both are written in C# and working with Movabletypes.

To get the list of APIs that are supported by your blog server:

This link explains howto do it.

View the source of your weblog's homepage.
In the of the HTML document, look for a link relation entitled "EditURI." It should look very similar to:
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="">
Cut and paste the value of the href attribute into your browser. This is the URL of the autodisovery document and contains a list of the APIs supported by the corresponding weblog.

To view your blog in atom format.

To view your blog in rss format.

How to open a popup window using Javascript

<A href="<YOUR POP WINDOW>" onclick="OpenWindow(this.href);return false;">tell us online</A>

-Provide the link in both onclick and the link's href attribute
-Instead of passing the url twice, one in href and one in onclick event, refer to the link's href attribute.
-Return false at the end of onclick method.

These rules enables us to update the link only in place. If the javascript is not supportted by the browser, users will be able to navigate by the link provided in the href attribute like a normal navigation.

Let's open a window with dynamic height. The height of the window will be calculated according to the screen resolution. Th width is 760. So we will center the window in the screen.

var popupWindow = null;
function OpenWindow(link)
if (popupWindow != null){
if(!popupWindow .closed)
popupWindow .close();

//Adjust the height according to the screen resolution
var height =800;
var left=20;
if (window.screen && window.screen.height && window.screen.width)
height = screen.height-70;
left = screen.width/2-380;
popupWindow (link, 'popupwindow','top=5,width=760,left=' + left + ',' + 'height=' + height + ',scrollbars,resizable');
popupWindow .focus();

How to implement CreateControlHierarcy in a Composite Control

There is a good article about how to implement a composite control and itexplains the usage of this method in detail.

CreateChildControls must accomplish at least the following tasks:
-Clear the Controls collection,
-Build the control's tree
-Clear the viewstate of child controls.

protected override void CreateChildControls()
//If it is not in design mode, get the posts and display them
if ((Page.Site == null) (!Page.Site.DesignMode))
else //Set design time properties
this.Width = 100;
this.Height = 10;