DISQUS

Emad Ibrahim: Shortening URLs with bit.ly’s API in .NET

  • ralph · 6 months ago
    Hi Emad

    I just tried your code, but it is throwing me an error at this part:
    var x = (from result in resultXml.Descendants("nodeKeyVal")
    ...

    It tells me : error CS1026: ) expected

    Do you have an idea why this may happen?

    Thanks
    ralph
  • eibrahim · 6 months ago
    Is that a compile error or runtime error? Did you copy & paste the code
    correctly? Sometimes the browser messes up the code formatting.

    Other than that you should add a breakpoint and examine the value of
    resultXml and see if it shows any error messages.

    Good luck.
  • raichelb · 5 months ago
    Hello,
    How do I define\declare xDocument variable correctly?
    Thanks
  • Chris Deweese · 1 month ago
    Great post, thanks for sharing this class. I had to make one Tweak to use this in a non-web app in VS 2010 Beta 2. HttpUtlity is in System.Web and it looks like there is no way to reference System.Web in VS 2010 Beta 2 from a console application.

    I changed the call to HttpUtility to use System.Uri.EscapeDataString and it worked like a charm.

    Good stuff!
  • deepjanardhanan · 2 days ago
    Guys,
    Dont forget to import the necessary assemblies.

    using System.Linq;
    using System.Web;
    using System.Xml.Linq;