Culture name 'xxxx' is not supported

T

Tomas Vera

Hello All,
In an effort to prepare my WebApp for localization, I have included the
following lines in some of my ASPX pages (the "lab mice" of my web app).

--- Code snippet -----
//---------------------------------------------------------------------
// Set up the localization
//---------------------------------------------------------------------
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

Thread.CurrentThread.CurrentUICulture = new
CultureInfo(Request.UserLanguages[0]);

LocRM= new ResourceManager("TapeWareCommerce2002.registration.regStrings",
typeof(activateprofile).Assembly);


Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

--- En dof snippet -----


But two users have received the following error:
"Culture name rs1_8414fa49133;q=0.0 is not supported. Parameter name: name"
(full stack trace at bottom).

Is there a better way to implement the CreateSpecificCulture() call?

TIA,
-tomas


Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.ArgumentException: Culture name
rs1_8414fa49133;q=0.0 is not supported. Parameter name: name

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.



Stack Trace:

[ArgumentException: Culture name rs1_8414fa49133;q=0.0 is not supported.
Parameter name: name]
System.Globalization.CultureInfo..ctor(String name, Boolean
useUserOverride) +218
System.Globalization.CultureInfo.CreateSpecificCulture(String name) +28
TapeWareCommerce2002.Registration.activateprofile.Page_Load(Object
sender, EventArgs e) +66
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi Tomas,

The name of the culture you pass to the CreateSpecificCulture seems to be
invalid. Valid culture names look like:

en-US
en-GB
ru-RU

and it is unlikely that "rs1_8414fa49133;q=0.0" is a culture name. You might
check with the docs what the UserLanguages property actually returns.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top