ASP.NET获得客户端浏览器语言设置(Get the Language setting of browser by ASP.NET)

代码如下:

<% @ Page Language = " C# "   %>

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

< script  runat ="server" >

    protected 
void  Page_Load(object sender, EventArgs e)
    {
        
int  count;
        String[] userLang 
=  Request.UserLanguages;

        
for  (count  =   0 ; count  <  userLang.Length; count ++ )
        {
            Response.Write(
" User Language  "   +  count  +   " "   +  userLang[count]  +   " <br> " );
        }
    }
</ script >

< html  xmlns ="http://www.w3.org/1999/xhtml" >
< head  runat ="server" >
    
< title > Untitled Page </ title >
</ head >
< body >
    
< form  id ="form1"  runat ="server" >
    
< div >
    
    
</ div >
    
</ form >
</ body >
</ html >

你可能感兴趣的:(language)