views:

32

answers:

1

Hi all I have a project that i reference the services for my graphs...and i have hardcoded urls something like -

ViewData["weeklyGraphURL"] = "\"http://localhost:9713/MyProject/MyAction"+Id + "\"";

So this url is basically another projects controller action...and i have both these projects in one solution...is there a way i could set a relative path to this project when I deploy it on the web server

+1  A: 

If they are always going to live on the same machine you could look at reading the server name out of Request.ServerVariables.Get("SERVER_NAME") and replacing localhost with that.

James O'Sullivan
ya but what about the port number...is there any way i could get it?
Misnomer
That's available via the SERVER_PORT server variable. Here's a list of all of the IIS server variables that are available:http://msdn.microsoft.com/en-us/library/ms524602%28v=VS.90%29.aspx
James O'Sullivan