implement xdocument timeout

Discussion in 'ASP .Net' started by André Freitas, Feb 12, 2010.

  1. 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é
     
    André Freitas, Feb 12, 2010
    #1
    1. Advertising

  2. André,

    I think you're looking for:
    XDocument.QueryAdapter.Timeout

    --


    Sincerely,

    S. Justin Gengo, MCP

    Free code library at:
    http://www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche

    "André Freitas" <andrefreitas> wrote in message
    news:...
    > 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é
    >
     
    S. Justin Gengo, Feb 12, 2010
    #2
    1. Advertising

  3. I cant found the property in XDocument MSDN library.

    André

    "S. Justin Gengo" <> escreveu na mensagem
    news:%23PWysh$...
    > André,
    >
    > I think you're looking for:
    > XDocument.QueryAdapter.Timeout
    >
    > --
    >
    >
    > Sincerely,
    >
    > S. Justin Gengo, MCP
    >
    > Free code library at:
    > http://www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzsche
    >
    > "André Freitas" <andrefreitas> wrote in message
    > news:...
    >> 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é
    >>
     
    André Freitas, Feb 12, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob Johnson
    Replies:
    0
    Views:
    3,816
    Bob Johnson
    Aug 7, 2003
  2. I. Myself
    Replies:
    0
    Views:
    695
    I. Myself
    May 1, 2006
  3. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,333
    Brian Candler
    Oct 6, 2004
  4. Jacob
    Replies:
    2
    Views:
    146
    Ron Fox
    Oct 1, 2008
  5. Li Chen
    Replies:
    2
    Views:
    100
    Li Chen
    Oct 28, 2008
Loading...

Share This Page