Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Seena 14 posts 34 karma points
    Jan 03, 2013 @ 19:56
    Seena
    0

    GetMedia does not return the correct url

    I'm trying to redirect to the media url, but using the code blow, results in the full url concatenated by the size of the media.

    So for example the url returns /media/123/example.pdfpdf4000

    XPathNodeIterator xName = umbraco.library.GetMedia(Convert.ToInt32(pdfid), false;
    string url = xName.Current.Value;
    Response.Redirect("~/"+ url);

    What is happening?

  • Nigel Wilson 945 posts 2077 karma points
    Jan 03, 2013 @ 21:47
    Nigel Wilson
    0

    Hi Seena

    Your code above is returning all the media information

    Just wondering if you might be better using the following:

    Media file = new Media(Convert.ToInt32(pdfid));
    string url = file.getProperty("umbracoFile").Value.ToString();
    Response.Redirect("~/"+ url);

    Hope this helps.

    Nigel

Please Sign in or register to post replies

Write your reply to:

Draft