I am trying to create an absolute path url so i can send to users via json:
So far i did it this way:
First, I created a static class with a static string:
public static class baseUrl
{
public static string getBaseUrl(){
return "http://myurl";
}
}
Second, on the model, I created a custom column that concatenates the string and creates a new field with the full absolute path:
public string Image
{
get
{
return baseUrl.getBaseUrl()+"/images/" +Id+ "/content/" + Img;
}
}
My question is if there is a way to get the base url instead of using a static string, so it will be automatically changed on different environments, or if there is a better way to achieve the desired result?