Here is the code to retreive the path from where a user control (ASCX) was loaded.
protected string GetLoadDirectory() { string controlPath = this.ResolveUrl(this.AppRelativeVirtualPath); if (string.IsNullOrEmpty(controlPath) == false) { int indexOfLastSlash = controlPath.LastIndexOf("/"); controlPath = controlPath.Substring(0, indexOfLastSlash + 1); } return controlPath; }
No comments:
Post a Comment