Q:
You create an ASP.NET application to provide corporate news and information to XYZ’s employees. The application is used by employees in New Zealand.
Default.aspx has a Web Form label control named currentDateLabel. The Page.Load event handler for Default.aspx included the following line of code:
currentDateLabel.Text = DateTime.Now.ToString(“D”)
You need to ensure that the data is displayed correctly for employees in New Zealand. What should you do?
Answer & Explanation
Answer: A) In the Web.config file for the application, set the culture attribute of the globalization element to en-NZ.
Explanation: The culture attribute of the globalization element specifies the default culture for processing incoming Web requests.
Incorrect Answers:
B: The uiculture attribute of the globalization specifies the default culture for processing locale dependent resource searches. It does not apply in this scenario.
C, D: The UTF8Encoding Class class encodes Unicode characters using UCS Transformation Format, 8-bit form (UTF-8). This encoding supports all Unicode character values and surrogates. However, it does not help in displaying data in New Zealand format.
View Answer
Report Error
Discuss