pete,
in code, you can use an actionfilter to determine whats going on:
public class AddUrlInfoToSessionAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (!filterContext.HttpContext.Request.IsAjaxRequest())
{
// where we are now - do something with the vars in real app
var currentActionName = filterContext.ActionDescriptor.ActionName;
var currentControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
var currentRouteData = filterContext.RouteData;
var currentUrlInfo = new UrlHelper(filterContext.RequestContext);
string url = RouteTable.Routes.GetVirtualPath(filterContext.RequestContext, currentRouteData.Values).VirtualPath;
}
}
}
and then decorate each controller that your interested in as below (or put it onto a basecontroller):
[HandleError]
[AddUrlInfoToSessionAttribute]
public class HomeController : Controller
{
// controller stuff
}
[AddUrlInfoToSession]
public abstract class BaseController : Controller
{
}
hope this helps
jim
EDIT: just tidied the example up a bit by adding the following to the filter method:
string url = RouteTable.Routes.GetVirtualPath(filterContext.RequestContext, currentRouteData.Values).VirtualPath;