I use HttpUrlBuilder from Rainbow portal (
www.rainbowportal.net):
public class HttpUrlBuilder
{
/// <summary>
/// Builds the url for get to current portal home page
/// containing the application path, portal alias, tab ID, and language.
/// </summary>
public static string BuildUrl()
{
return(BuildUrl("~/" + HttpUrlBuilder.DefaultPage, 0, 0, null, string.Empty,
string.Empty,string.Empty));
}
/// <summary>
/// Builds the url for get to current portal home page
/// containing the application path, portal alias, tab ID, and language.
/// </summary>
/// <param name="targetPage">Linked page</param>
public static string BuildUrl(string targetPage)
{
return(BuildUrl(targetPage, 0, 0, null, string.Empty, string.Empty,
string.Empty));
}
...... (many lines of code)
It load site url from web config and create urls. In aspx files I use
HttpUrlBuild too:
<a href='<%# Beer.HttpUrlBuilder.BuildUrl("Default.aspx")%>'><i mg src='<%#
Beer.HttpUrlBuilder.BuildUrl("img/logo.gif")%>' height="92" width="157"
alt="îÁ ÇÌÁ×ÎÕÀ" hspace="20"></a>
"Janaka" <ja****@magicalia.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:uM**************@TK2MSFTNGP15.phx.gbl...
I'm making a web application on my local server which will then be rolled
out onto our live site. My problem is that i tend to have to comment out
and make a few new hard-coded lines in my files to edit changes locally
and then i have to reverse this process to make any changes live. See below
// local myLink.NavigateUrl = "http://localhost/TestSite/Printout.aspx";
myLink.NavigateUrl = http://www.mysite.com/Printout.aspx;
I'm thinking of making a variable in my web.config file to check whether
i'm running the application locally or not. So the following code below will
work:
bool isTest =
Convert.ToBoolean(ConfigurationSettings.AppSetting s["TestSite"]);
if (isTest)
myLink.NavigateUrl = "http://localhost/TestSite/Printout.aspx";
else
myLink.NavigateUrl = http://www.mysite.com/Printout.aspx;
Is there a better method of doing this? Maybe with the Debug class or
something that runs in debugging mode?
Thanks, Janaka