Tuesday, December 18, 2007

Get the URL of the host from the UserControl

this.Parent.Parent.Page.AppRelativeVirtualPath gives the URL
another way is:

public static string GetLocalPath
{
get
{
string path = "~" + HttpContext.Current.Request.Url.LocalPath;
path = path.ToLower();
return path
}

This query can be placed in Global.asax.cs and can be used by both the UserControl and any page.

No comments: