Torna al Thread

Imports System.Web.Profile Imports System.Globalization Imports System.Threading Public Class PaginaBase Inherits System.Web.UI.Page Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs) If Not String.IsNullOrEmpty(Request.QueryString("theme")) Then Me.Theme = Request.QueryString("theme") ElseIf String.IsNullOrEmpty(Request.QueryString("theme")) And HttpContext.Current.Profile.GetPropertyValue("Theme").ToString() <> "" Then Me.Theme = HttpContext.Current.Profile.GetPropertyValue("Theme").ToString() ElseIf String.IsNullOrEmpty(Request.QueryString("theme")) And HttpContext.Current.Profile.GetPropertyValue("Theme").ToString() = "" Then Me.Theme = "default_theme" End If MyBase.OnPreInit(e) End Sub Protected Overrides Sub InitializeCulture() ' override virtual method InitializeCulture() to check if profile contains a user language setting Dim UserCulture As String = HttpContext.Current.Profile.GetPropertyValue("PreferredCulture").ToString() If UserCulture <> "" Then ' there is a user language setting in the profile: switch to it Thread.CurrentThread.CurrentUICulture = New CultureInfo(UserCulture) Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(UserCulture) End If End Sub 'InitializeCulture End Class
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5