The simplest way is to use Virtual path instead of an absolute path. Or use
Page.ResolveUrl
method to specify the home path and add page url to it. Something like
string leaveAddressForApproval = Page.ResolveUrl("~/") + "LeaveRequest.aspx?leaveRequestNo=" + txtLeaveNo.Text;
Still, if you need more flexibility, you got two options.
1) Get it from the database. But it's important to have it Cached so you don't need to make db call again and again. In our case, we have a table where we store such config related things in name value pair. We keep that table in Cache and use those values. So yes, that is an option.
2)Store it in your web.config. You can save it using Key-Value pair under ClientConfig > Paths node. In your release web.config add production url, in your local one use localhost url. You can access it by specifying
ClientConfig.Paths["Key"];
Hope that helps!