There have been some questions posted in the SharePoint development newsgroups about how to appropriately get some object URL's in SharePoint.
Here are some examples:
PLAIN TEXT
C#:
public string GetListUrl(SPList oList)
{
if (oList.DefaultView == null)
{
return oList.ParentWeb.Url;
}
return (oList.ParentWeb.Url + "/" + oList.DefaultView.Url);
}
public string GetWebUrl(SPWeb oWeb)
{
return oWeb.Url;
}
private string GetCurRequestUrl()
{
string l_strCurRequest = this.Page.Request.Url.AbsoluteUri;
if (l_strCurRequest.IndexOf("/", 8)>= 0)
{
l_strCurRequest = l_strCurRequest.Substring(0, l_strCurRequest.IndexOf("/", 8));
}
return l_strCurRequest;
}
Pretty [...]
Continue Reading This Article...