Edit: The following will give the path to the assembly with the controller and the type name of the class with the controller action. Maybe a combination of these will give you what you're after, Aaron?
string assemblyPath = Assembly.GetExecutingAssembly().CodeBase;
string typeName = this.GetType().FullName;
They yield, for example, something like
file:///C:/Projects/TestApp/TestApp.UI/bin/TestApp.UI.DLL
TestApp.UI.Controllers.TestController
Provided that you place and name the controllers in the 'standard' ASP.NET MVC ways, a certain combination of the above might give you the correct full path to the C# file:
C:/Projects/TestApp/TestApp.UI/Controllers/TestController.cs
or the relative path:
Controllers/TestController.cs
The following will give the route to the controller action:
1) string path = Request.Url.AbsolutePath
2) string appPath = Request.ApplicationPath;
string absPath = Request.Url.AbsolutePath;
string path = appPath.Length <= 1 ?
absPath : absPath.Replace(appPath, "");
Example for the request for a TestController's Index action (http://localhost:50027/Test/Index): The above returns
1) /Test/Index
2) /Test/Index
For a website with base url at http://localhost:50027/blog, example for the request for a TestController's Index action (http://localhost:50027/blog/Test/Index): The above returns
1) /blog/Test/Index
2) /Test/Index