Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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))
        {
            IISCommonFunctions.IISCurrentEnvironment.SetLanguage(selectedValue);

            HttpResponse.RemoveOutputCacheItem("/_controltemplates/Services/NavigationWebPart.ascx");
            Response.Redirect(Request.Path);

        }
    }

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.