implement xdocument timeout

A

André Freitas

Im using a xDocument with Linq to get the last 10 blog entries. Like this:

XDocument xDocument = XDocument.Load("SOMEURL");
var linq =
from itens in xDocument.Root.Elements("channel").Elements("item").Take(10)
select new
{
title = (string)itens.Element("title"),
link = (string)itens.Element("link")
};
rptBlogFeed.DataSource = linq;
rptBlogFeed.DataBind();

The problem: I already got the blog feed (third-apart) offline a few times,
and when it ocours, if the site is not cached, the user gets a error. I have
encapsulated the code in a TRY clause, and Im returning a "impossible to
connect with blog" in case of error, but the user still gets a long time
waiting the page to load. So I need two things, that I have no idea about
how to reach:

First, load the entire site, and load the blog feeds later, maybe changing a
LOADING message with the correct data, but I dont know how to do that.
Second, implement a timeout in that request (httprequest?), with a two
seconds timeout, or something like that.

If someone can point me a direction I ll be very glad.

All the best,
André
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top