public void ProcessRequest(HttpContext context)
        {
            try
            {
                string rootUrl = HostingEnvironment.MapPath("~/");
                var    input   = new XMLRPCRequest(context);
                var    output  = new XMLRPCResponse(input.MethodName);

                switch (input.MethodName)
                {
                case "blogger.getUsersBlogs":
                case "metaWeblog.getUsersBlogs":
                    output.Blogs = GetUserBlogs(input.AppKey, input.UserName, input.Password, rootUrl);
                    break;

                case "metaWeblog.newPost":
                    output.PostID = NewPost(input.BlogID, input.UserName, input.Password, input.Post, input.Publish);
                    break;

                case "metaWeblog.editPost":
                    output.Completed = EditPost(input.PostID, input.UserName, input.Password, input.Post, input.Publish);
                    break;

                case "metaWeblog.getPost":
                    output.Post = GetPost(input.PostID, input.UserName, input.Password);
                    break;

                case "metaWeblog.newMediaObject":
                    output.MediaInfo = NewMediaObject(input.BlogID, input.UserName, input.Password, input.MediaObject, context);
                    break;

                case "metaWeblog.getCategories":
                    output.Categories = GetCategories(input.BlogID, input.UserName, input.Password, rootUrl);
                    break;

                case "metaWeblog.getRecentPosts":
                    output.Posts = GetRecentPosts(input.BlogID, input.UserName, input.Password, input.NumberOfPosts);
                    break;

                case "blogger.deletePost":
                    output.Completed = DeletePost(input.AppKey, input.PostID, input.UserName, input.Password, input.Publish);
                    break;

                case "blogger.getUserInfo":
                    //Not implemented.  Not planned.
                    throw new MetaWeblogException("10", "The method GetUserInfo is not implemented.");

                case "wp.newPage":
                    output.PageID = NewPage(input.BlogID, input.UserName, input.Password, input.Page, input.Publish);
                    break;

                case "wp.getPageList":
                case "wp.getPages":
                    output.Pages = GetPages(input.BlogID, input.UserName, input.Password);
                    break;

                case "wp.getPage":
                    output.Page = GetPage(input.BlogID, input.PageID, input.UserName, input.Password);
                    break;

                case "wp.editPage":
                    output.Completed = EditPage(input.BlogID, input.PageID, input.UserName, input.Password, input.Page, input.Publish);
                    break;

                case "wp.deletePage":
                    output.Completed = DeletePage(input.BlogID, input.PageID, input.UserName, input.Password);
                    break;

                case "wp.getAuthors":
                    output.Authors = GetAuthors(input.BlogID, input.UserName, input.Password);
                    break;

                case "wp.getTags":
                    output.Keywords = GetKeywords(input.BlogID, input.UserName, input.Password);
                    break;
                }

                output.Response(context);
            }
            catch (MetaWeblogException mex)
            {
                XMLRPCResponse output = new XMLRPCResponse("fault");
                MWAFault       fault  = new MWAFault();
                fault.faultCode   = mex.Code;
                fault.faultString = mex.Message;
                output.Fault      = fault;
                output.Response(context);
            }
            catch (Exception ex)
            {
                XMLRPCResponse output = new XMLRPCResponse("fault");
                MWAFault       fault  = new MWAFault();
                fault.faultCode   = "0";
                fault.faultString = ex.Message;
                output.Fault      = fault;
                output.Response(context);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string rootUrl = HostingEnvironment.MapPath("~/");
                var input = new XMLRPCRequest(context);
                var output = new XMLRPCResponse(input.MethodName);

                switch (input.MethodName)
                {
                    case "blogger.getUsersBlogs":
                    case "metaWeblog.getUsersBlogs":
                        output.Blogs = GetUserBlogs(input.AppKey, input.UserName, input.Password, rootUrl);
                        break;
                    case "metaWeblog.newPost":
                        output.PostID = NewPost(input.BlogID, input.UserName, input.Password, input.Post, input.Publish);
                        break;
                    case "metaWeblog.editPost":
                        output.Completed = EditPost(input.PostID, input.UserName, input.Password, input.Post, input.Publish);
                        break;
                    case "metaWeblog.getPost":
                        output.Post = GetPost(input.PostID, input.UserName, input.Password);
                        break;
                    case "metaWeblog.newMediaObject":
                        output.MediaInfo = NewMediaObject(input.BlogID, input.UserName, input.Password, input.MediaObject, context);
                        break;
                    case "metaWeblog.getCategories":
                        output.Categories = GetCategories(input.BlogID, input.UserName, input.Password, rootUrl);
                        break;
                    case "metaWeblog.getRecentPosts":
                        output.Posts = GetRecentPosts(input.BlogID, input.UserName, input.Password, input.NumberOfPosts);
                        break;
                    case "blogger.deletePost":
                        output.Completed = DeletePost(input.AppKey, input.PostID, input.UserName, input.Password, input.Publish);
                        break;
                    case "blogger.getUserInfo":
                        //Not implemented.  Not planned.
                        throw new MetaWeblogException("10", "The method GetUserInfo is not implemented.");
                    case "wp.newPage":
                        output.PageID = NewPage(input.BlogID, input.UserName, input.Password, input.Page, input.Publish);
                        break;
                    case "wp.getPageList":
                    case "wp.getPages":
                        output.Pages = GetPages(input.BlogID, input.UserName, input.Password);
                        break;
                    case "wp.getPage":
                        output.Page = GetPage(input.BlogID, input.PageID, input.UserName, input.Password);
                        break;
                    case "wp.editPage":
                        output.Completed = EditPage(input.BlogID, input.PageID, input.UserName, input.Password, input.Page, input.Publish);
                        break;
                    case "wp.deletePage":
                        output.Completed = DeletePage(input.BlogID, input.PageID, input.UserName, input.Password);
                        break;
                    case "wp.getAuthors":
                        output.Authors = GetAuthors(input.BlogID, input.UserName, input.Password);
                        break;
                    case "wp.getTags":
                        output.Keywords = GetKeywords(input.BlogID, input.UserName, input.Password);
                        break;
                }

                output.Response(context);
            }
            catch (MetaWeblogException mex)
            {
                XMLRPCResponse output = new XMLRPCResponse("fault");
                MWAFault fault = new MWAFault();
                fault.faultCode = mex.Code;
                fault.faultString = mex.Message;
                output.Fault = fault;
                output.Response(context);
            }
            catch (Exception ex)
            {
                XMLRPCResponse output = new XMLRPCResponse("fault");
                MWAFault fault = new MWAFault();
                fault.faultCode = "0";
                fault.faultString = ex.Message;
                output.Fault = fault;
                output.Response(context);
            }
        }