I am assuming that you are asking it in the context of output caching, so a simple approach is to use VaryByCustom
. For example,
<%@ OutputCache VaryByCustom="Culture" ... %>
And in global.asax
public override string GetVaryByCustomString(HttpContext Context, string Custom)
{
if (Custom == "Culture")
{
// return culture specific string
return Context.Request.UserLanguages[0];
}
return base.GetVaryByCustomString(Context, Custom);
}
The implementation will vary depending upon how you are tracking the current user's culture. For example, you might be using session variable (or profile data), so you need to return the current user's culture based on session variable etc.
From SEO friendly-ness (can matter if your web site is content oriented), you may want to have culture info as part of your url. For example,
<%@ OutputCache ... varybyparam="Culture" %>
http://www.yourdomain.com/somepage.aspx?Culture=en
http://www.yourdomain.com/somepage.aspx?Culture=fr