Microsoft KB Archive/812303

= How to bypass the locale selection page in your Commerce Server 2002 Retail Web site =

Article ID: 812303

Article Last Modified on 1/2/2004

-

APPLIES TO


 * Microsoft Commerce Server 2002 Standard Edition
 * Microsoft Commerce Server 2002 Service Pack 2

-



SUMMARY
The Retail2002 solution Web site that is included with Microsoft Commerce Server 2002 incorporates multilanguage and multiple Country/Region features. However, you may not want users to view the locale selection page when they visit your Web site.

This article discusses how to modify the code in the Application.cs file to bypass the locale selection page. After you modify the code, the user does not receive the prompt to &quot;Select Country/Region and Language&quot; the first time that the user visits the Web site. Instead, the application starts on the Web site's home page.



MORE INFORMATION
In the Application.cs file, the section of the code that sets the locale is in the Application_BeginRequest procedure. The following code is the part of this procedure sets the locale. //           //  Get the current culture information for this request. This // information comes from the current user's profile ticket. //

CultureInfo cultureInfo = CommerceApplication.CurrentProfileCulture;

if ( cultureInfo != null ) {               //                //  Set the current thread context to this culture. //

Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; }           //            //  Handle special-case documents //

string currentDocument = this.CurrentDocument;

//           //  Check to see if the current user has been authenticated before. //

if ( CommerceContext.Current.AuthenticationInfo.IsAuthenticated == false ) {               //                //  This user has not been authenticated. Is this a new visitor to site? //

string userID = AccountManager.ProfileTicketUserID;

if ( userID == null ) {                   //                    //  The profile ticket doesn't appear valid. Create a new anonymous user // account to track this user. //

AccountManager.CreateAnonymousUserAccount; }           }            //            //  If the current document doesn't match the following // criteria then go to the locale selection page and // get some answers. //           if ( cultureInfo == null ) {               if ( currentDocument != &quot;localeselection.aspx&quot;  &&                      currentDocument != &quot;customerror.aspx&quot;      &&                      currentDocument != &quot;notfound.aspx&quot;         &&                      currentDocument != &quot;bdrefresh.aspx&quot;        &&                      currentDocument != &quot;refreshapp.aspx&quot;       &&                     currentDocument != &quot;passportlogin.aspx&quot;    &&                     currentDocument != &quot;passportlogout.aspx&quot;   &&                     currentDocument != &quot;logout.aspx&quot;                    ) {                   //                    //  Redirect to the locale selection page and on return // redirect back to the calling page. //

CommerceApplication.Redirect(&quot;localeselection.aspx&quot;, currentDocument, false); }           }

//           //  Check for secure documents. //

SecureDocument secureDocument = CommerceApplication.GetSecureDocument(currentDocument); To bypass the locale selection process, follow these steps:  In the Application.cs file, locate the procedure Application_BeginRequest.  Locate the previous section of code in the procedure, and then replace that code with the following code. //           //  Get the current culture information for this request. This // information comes from the current user's profile ticket. //

CultureInfo cultureInfo = CommerceApplication.CurrentProfileCulture; string cultureName = &quot;en-US&quot;; CommerceApplication.CurrentProfileCulture = new CultureInfo(cultureName); cultureInfo= new CultureInfo(cultureName);

if ( cultureInfo != null ) {               //                //  Set the current thread context to this culture. //

Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; }           //            //  Handle special-case documents //

string currentDocument = this.CurrentDocument;

//           //  Determine whether the current user has been authenticated before. //

if ( CommerceContext.Current.AuthenticationInfo.IsAuthenticated == false ) {               //                //  This user has not been authenticated. Is this a new visitor to site? //

string userID = AccountManager.ProfileTicketUserID;

if ( userID == null ) {                   //                    //  The profile ticket does not appear to be valid. Create a new anonymous user // account to track this user. //

AccountManager.CreateAnonymousUserAccount; }           }            //            //  Determine whether there are secure documents. //

SecureDocument secureDocument = CommerceApplication.GetSecureDocument(currentDocument);  Recompile the application, and then visit the Web site in your browser. Notice that the locale selection page does not appear.

Additional query words: Retail2002

Commerce Server 2002

Localization

Multi-culture

Multi-Language

Locale

Keywords: kbhowto kbinfo KB812303

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.