I want to use OutputCache to open pages more quickly. There is 2 languages in site ( LanguageResource.resx and LanguageResource.az.resx). In controller:
public class HomeController : Controller
{
[OutputCache(Duration=3600,VaryByParam="none", VaryByCustom="lang")]
public ActionResult Index()
{
//........
}
public ActionResult ChangeCulture( string lang, string returnUrl )
{
Session["Culture"] = new CultureInfo( lang );
return Redirect( returnUrl );
}
}
In Layout.cshtml:
<a href="@Url.Action( "ChangeCulture", "Home", new { lang = "en", returnUrl = this.Request.RawUrl } )">Eng</a>
<a href="@Url.Action( "ChangeCulture", "Home", new { lang = "az", returnUrl = this.Request.RawUrl } )">Az</a>
In Global.asax I wrote:
pro ...
Go to the complete details ...