Is there a way to get the class file name?
In particular, I would like to create a static method (CreateLink) in the base class (BasePage) to automatically return the path and file name of the called page.
I am code in C # ASP.NET
private const string TEMPLATE = "~/One.aspx"; public static HyperLink CreateLink() { HyperLink link = new HyperLink(); link.Text = "Click here"; link.NavigateUrl = String.Format(TEMPLATE); return link; }
Is it possible to avoid using a hard-coded TEMPLATE variable? Is it possible to get the One.aspx path from the file name and location?
source share