I think this is what you need:
((WebFormView) ViewContext.View).ViewPath
Obviously, this only works if you use the standard mechanism for viewing web forms (which is based on the wording of your question, you). That is, ViewContext.View returns an ViewContext.View , which cannot be a WebFormView if you use a different viewing mechanism.
Change By the way, I tested the code above, and it definitely returns the path as a virtual path (and not the absolute or relative path of the application, as I assumed, suggested that it can). That is, it gives you a value similar to this:
~/Views/Company/Create.aspx
source share