Take the 2-minute tour ×

Iam using to cache my asp.net mvc pages

[OutputCache(VaryByParam = "something", Duration = 1800, Location = System.Web.UI.OutputCacheLocation.Server)]
public ActionResult MyPage()


problem is cached page is not picked up when some one adds a trailing slash character("/")


//cache entry 1

//cache entry2
share|improve this question

2 Answers 2

protected void Application_AcquireRequestState(object sender, EventArgs e)
    string url = HttpContext.Current.Request.Url.AbsolutePath;
    if (string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query))
        int i = url.LastIndexOf('/');
        if (i < (url.Length - 1))
            url += "/";

some problem. trying... but nor work :(

share|improve this answer

To my knowledge it's not good to have one page accessible via many different URL's. So you could make you application to redirect when it encounters trailing slash.

share|improve this answer

Your Answer


