Copied to clipboard

Flag this post as spam?

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


  • marthin 87 posts 106 karma points
    Nov 09, 2010 @ 15:51
    marthin
    0

    Getting the Uri

    Hi,

     

    Im using a c# webservice to return images from umbraco, but right now i only get the file location like "/media/416/myfile.jpg" I need to get a full address like "http://foo1.mysite.com/media/416/myfile.jpg"

    Is there a built in way to get this from a media object? Or do I have to construct it myself? If I need to do it myself, how can i do this from a webservice in .net? I cant use Request.Url.Host to create the string and since because im in a webserivce or somethign like that. So I cant create the correct address like "http://foo1.mysite.com".

     

    Thx for any help!

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Nov 09, 2010 @ 17:55
    Sebastiaan Janssen
    0

    ARE you in a webservice or do you THINK you're in a webservice?

    Normally you would use HttpContext.Current.Request.ServerVariables["SERVER_NAME"] and construct the full URL yourself, yes.

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Nov 09, 2010 @ 17:56
    Sebastiaan Janssen
    0

    Oops, hit submit too soon. So I was wondering why are you using a webservice? Maybe there's an easier way that we can recommend?

  • marthin 87 posts 106 karma points
    Nov 11, 2010 @ 14:19
    marthin
    0

    Im calling the webservice from a normal page, the webservice is in the "webservice" folder and the page is a normal page create from within umbraco that has a .Net macro that calls the webservice. Im trying to get a image list by a jquery ajax call.

     

    I tried to do a little remake and onyl returned to url from the media dir, so now i'v got "/media/416/myfile.jpg" and then a when i get this to the page calling the webservice i use jquery to call "document.domain" and this craetes the full path lik "http://myipaddress.com/media/416/myfile.jpg" BUT now iv got a problem. I cant access the fle? Iv trieded to write it in the url-field and it only returns a

    404 - File or directory not found.

    I use multiple sites within my installation so i let umbraco rewrite the URL to "http://myipaddress.com/site1" and "http://myipaddress.com/site2" adn so on. Do I have to change some security settings or something to acces the media? And when i access the media do i need to acces it thrue the "http://myipaddress.com/site1/media/" OR do i go straight under "http://myipaddress.com/media/" without the site category?

     

    Thx for any help!

    Marthin

     

  • marthin 87 posts 106 karma points
    Nov 11, 2010 @ 14:27
    marthin
    0

    My apologize for taking your time! I found the problem, i tried to access the tumbnail images, and spelled it "tumb" instead of the correct "thumb".

    Thx for your help anyway!

Please Sign in or register to post replies

Write your reply to:

Draft