简体   繁体   中英

How to get CultureInfo from client machine?

so this is question for 1mln$.

First of all, I'm developing web application in Visual WebGui. This is basically Winforms, but than application is converted to HTML5 and vualá.. web application. Anyway, I have a problem with DateTime formats. By default it is CultureInfo from server machine.

I can override this in web.config like that:

<globalization requestEncoding="utf-8" responseEncoding="utf-8"  culture="de-DE" uiCulture="de-DE"/>

Every dateformat will be german on every client machine. What I want is to make a web application, which will display Datetime format like on client machine in control panel.

Is it possible? I just can't find the solution.

Thanks for help,

Try this:

Thread.CurrentThread.CurrentCulture = new CultureInfo(Request.UserLanguages[1]);

Check this link for example Multilingual Application

You can set the uiculture and culture attributes of the globalization tag to auto. This will enable you to let the server decide the user's language according to his browser's settings and everything will happen automatically if you use localized resources.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM