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".
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?
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!
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.
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?
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
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!
is working on a reply...