Asp.net supports multilingual sites
1. Create two resources files on the web site as follows:
File Information in resources. resx
File Information in resources. en-us.resx
Default. aspxCode
Code
<% @ Page Language = " C # " Autoeventwireup = " True " Codefile = " Default. aspx. CS " Inherits = " _ Default " Culture = " Auto " Uiculture = " Auto " %>
<!Doctype HTML public"-// W3C // dtd xhtml 1.0 transitional // en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< HTML xmlns = " Http://www.w3.org/1999/xhtml " >
< Head runat = " Server " >
< Title > Global_resource </ Title >
</ Head >
< Body >
< Form ID = " Form1 " Runat = " Server " >
< Div >
< ASP: Calendar ID = " Calendar1 " Runat = " Server " > </ ASP: Calendar >
< ASP: button ID = " Button1 " Runat = " Server " Onclick = " Button#click " Text = " Confirm " />
< ASP: Label ID = " Label1 " Runat = " Server " Text = " Label " > </ ASP: Label > </ Div >
</ Form >
</ Body >
</ Html >
Default. aspx. CS code
Code
Using System;
Using System. Data;
Using System. configuration;
Using System. Web;
Using System. Web. Security;
Using System. Web. UI;
Using System. Web. UI. webcontrols;
Using System. Web. UI. webcontrols. webparts;
Using System. Web. UI. htmlcontrols;
Public Partial Class _ Default: system. Web. UI. Page
{
Protected Void Page_load ( Object Sender, eventargs E)
{
Page. Title = Resources. Resource. pagefile;
Response. Write (resources. Resource. Question + " <Br/> " );
}
Protected Void Button#click ( Object Sender, eventargs E)
{
Int Days = Datetime. Now. dayofyear - Calendar1.selecteddate. dayofyear;
If (Days > 0 )
{
Label1.text = String . Format (resources. Resource. Answer ,( 365 - Days). tostring ());
}
Else
Label1.text= String. Format (resources. Resource. Answer, math. Abs (days). tostring ());
}
}
The running result is as follows:
Note that in the default. aspx file, pay attention to the attribute values in the culture.
If you want the browser to display webpage content in Chinese, you can set the "tool"> "interner option"> "language" in the browser.