Simple enough, it would seem, but it turns out not to be - mainly due to the fact that the View can\'t possibly know which way through Model and Controller you got there. Regard
You can use Page.Request.Url
to get the route that resulted in the currently rendered view.
Though that's more of a cosmetic detail, you might want to unify the requests that came through the '/' and '/default.aspx' routes and always return to the '/' route. I have a helper property in my master page that does exactly that.
protected Uri RouteUrl
{
get
{
if (Page.Request.Url.AbsolutePath.StartsWith("/default.aspx", StringComparison.OrdinalIgnoreCase))
{
return new Uri(Request.Url, new Uri(Response.ApplyAppPathModifier("~/")));
}
return Page.Request.Url;
}
}