Google Anlatics

Sunday, August 7, 2011

Different Language in Sitemap ASP.NET 4.0

Different Language with Sitemap ASP.NET 4.0
For Set up Custom Error Page these are the setup for it.
If you are using IIS 7.0 of Web server, these are link to how we can create custom error page for error 404.

<httpErrors errorMode="Custom" existingResponse="Auto">
<clear />
<error statusCode="404" prefixLanguageFilePath="" path="/error/errorsitemap.aspx?status=404" responseMode="ExecuteURL" />
<error statusCode="401" prefixLanguageFilePath="" path="/error/default.aspx?status=401" responseMode="ExecuteURL" />
<error statusCode="403" prefixLanguageFilePath="" path="/error/default.aspx?status=403" responseMode="ExecuteURL" />
<error statusCode="405" prefixLanguageFilePath="" path="/error/default.aspx?status=405" responseMode="ExecuteURL" />
<error statusCode="406" prefixLanguageFilePath="" path="/error/default.aspx?status=406" responseMode="ExecuteURL" />
<error statusCode="410" prefixLanguageFilePath="" path="/error/default.aspx?status=404" responseMode="ExecuteURL" />
<error statusCode="412" prefixLanguageFilePath="" path="/error/default.aspx?status=412" responseMode="ExecuteURL" />
<error statusCode="500" prefixLanguageFilePath="" path="/error/default.aspx?status=500" responseMode="ExecuteURL" />
<error statusCode="501" prefixLanguageFilePath="" path="/error/default.aspx?status=501" responseMode="ExecuteURL" />
<error statusCode="502" prefixLanguageFilePath="" path="/error/default.aspx?status=502" responseMode="ExecuteURL" />

httpErrors>
if you’re using Custom Error Mode

<customErrors defaultRedirect="/error/errorsitemap.aspx" mode="On" redirectMode="ResponseRewrite" >
<error statusCode="404" redirect="/error/errorsitemap.aspx?status=404" />
<error statusCode="500" redirect="/error/default.aspx?status=500" />

…… All the error code has to come here like above httpErrors section

customErrors>

If you are using Site map like flowing example
Web.CA.en-CA.sitemap
Web.CA.en-US.sitemap
Web.CA.fr-CA.sitemap

Then have to overwrite InitializeCulture() method of page.
Refer below link for more information
Protected override void InitializeCulture()
{
//Resetting the culture when the URL is contain fr
int rawLocalizeUrl = Request.RawUrl.IndexOf("/fr/");
if (rawLocalizeUrl >= 0)
{
UICulture = "fr-CA";
}
base.InitializeCulture();
}
Other wise
v Microsoft .NET Framework 4: What is New in Globalization Can be found in following links.
Localization with script
Sri Lanka .NET 
                Forum Member