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 != "localeselection.aspx" &&
currentDocument != "customerror.aspx" &&
currentDocument != "notfound.aspx" &&
currentDocument != "bdrefresh.aspx" &&
currentDocument != "refreshapp.aspx" &&
currentDocument != "passportlogin.aspx" &&
currentDocument != "passportlogout.aspx" &&
currentDocument != "logout.aspx"
)
{
//
// Redirect to the locale selection page and on return
// redirect back to the calling page.
//
CommerceApplication.Redirect("localeselection.aspx", 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 = "en-US";
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.