im working with asp.net mvc4 and i have in 'controller1' this action :
[HttpGet]
public async Task<string> Action1()
{
try
{
HttpClient cl = new HttpClient();
string uri = "controller2/action2";
HttpResponseMessage response = await cl.GetAsync(uri);
response.EnsureSuccessStatusCode();
return response.ToString();
}
catch
{
return null;
}
}
when i set uri to "http://localhost:1733/controller2/action2" the action works fine, BUT never with uri set to "controller2/action2" or "/controller2/action2" or "~/controller2/action2".
how can i write this action without hardcoding the uri ?
Thank you.