R
Roshawn Dawson
Hi,
I've tried my best to convert the C# code below to it's VB equivalent.
I've even used all of the free code converters there are on the net, but
none can get this right. Here is the code:
internal static string ResolveUrl(string appPath, string url)
{
if (url.Length == 0 || url[0] != '~')
return url;// there is no ~ in the first character position, just
return the url
else
{
if (url.Length == 1)
return appPath; // there is just the ~ in the URL, return the appPath
if (url[1] == '/' || url[1] == '\\')
{
// url looks like ~/ or ~\
if (appPath.Length > 1)
return appPath + "/" + url.Substring(2);
else
return "/" + url.Substring(2);
}
else
{
// url looks like ~something
if (appPath.Length > 1)
return appPath + "/" + url.Substring(1);
else
return appPath + url.Substring(1);
}
}
}
The problem is that all of the code converters on the web treat the
"url" parameter as if it were an array, but it isn't.
Can anyone help me? I sure could use your expertise.
TIA,
Roshawn
I've tried my best to convert the C# code below to it's VB equivalent.
I've even used all of the free code converters there are on the net, but
none can get this right. Here is the code:
internal static string ResolveUrl(string appPath, string url)
{
if (url.Length == 0 || url[0] != '~')
return url;// there is no ~ in the first character position, just
return the url
else
{
if (url.Length == 1)
return appPath; // there is just the ~ in the URL, return the appPath
if (url[1] == '/' || url[1] == '\\')
{
// url looks like ~/ or ~\
if (appPath.Length > 1)
return appPath + "/" + url.Substring(2);
else
return "/" + url.Substring(2);
}
else
{
// url looks like ~something
if (appPath.Length > 1)
return appPath + "/" + url.Substring(1);
else
return appPath + url.Substring(1);
}
}
}
The problem is that all of the code converters on the web treat the
"url" parameter as if it were an array, but it isn't.
Can anyone help me? I sure could use your expertise.
TIA,
Roshawn