The suggested solution:
<HTML lang="<%= PageLanguage %>">
works fine. There's another alternative that Aleris is onto but hasn't got quite right. If you add the runat="server" attribute to the HTML tag, it will be parsed to a server-side HtmlGenericControl and be available in the Controls collection. Further, if you add an id attribute, you will have a variable in the code behind to access it directly, thus:
<html runat="server" id="html">
in codebehind:
html.Attributes["lang"] = "en";
Note: this is true for any HTML tag in your page.
Edit: I see now Aleris did get it right - he refers to 'a text' (actually, a LiteralControl) in the Controls collection that contains the html tag (along with the doctype and anything else up to the first server tag). You could manipulate this text, of course, and it would be (as he says) a hack - but it would restrict the changes to code-behind only.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…