SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to improve my site performance using output cache. The problem is that the site is in 2 languages. The site is a sharepoint site. I use:

<%@ OutputCache Duration="1800" VaryByParam="None" %>

on the user control of my navigation visual web part. On code behing when I switch language

protected void ddlLanguages_SelectedIndexChanged(object sender, EventArgs e)
        string selectedValue = ddlLanguages.SelectedValue.ToString();
        if (!String.IsNullOrEmpty(selectedValue))



But the problem here is that nothing happens. Nothing is cleared from cache. Maybe the virtual path it's not right?

share|improve this question
up vote 0 down vote accepted

Your Code behind won't be executed anymore once the page / component is in cache. You could point to the same url with a different querystring (eg : ?lg=fr) and have this query string parameter in your output cache declaration

<%@ OutputCache Duration="1800" VaryByParam="lg" %>

Alternatively, it's often better to rely on the output cache profile / framework of SharePoint, within it you'll also be able to adapt your varbyparam / varybycustom without implementing it on all your user control / webparts / pages.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.