I need to find out name of location where web user control is. Somethnig like HttpContext.Current.Request.Url.ToString(), but I get only page for this web user control.
Request.Url.Segments will give you a string array. The last item is the page
You should try the Request.Url.LocalPath
property
string fileNameFromLocalPath = Path.GetFileName(Request.Url.LocalPath);
This code helps:
string filename = Path.GetFileName(Request.Url.AbsolutePath);
If you ask for Page.getType.name, you will get the name of the master, the aspx page. if you want the name of the ascx control you are working on, use me.GetType.Name.ToString if your control is in a directory MyDir and the name of your ascx is test.ascx then the result will be
"ASP.MyDir_test_ascx"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With