I've setup a web site to be localized using Global resources only. I'm having a hard time figuring out why a page is always giving inconsistent behavior every time I trigger a culture change through a drop down list. Here are my resource files:
Resources:
Setup
Here is the Base Page that is inherited by all pages:
public partial class BaseWebForm : Page
{
protected override void InitializeCulture()
{
if (Session["UserLanguage"] != null)
{
String selectedLanguage = Session["UserLanguage"].ToString();
UICulture = selectedLanguage;
Culture = selectedLanguage;
CultureInfo culture = CultureInfo.CreateSpecificCulture(selectedLanguage);
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
base.InitializeCulture();
}
}
I'm using a Session variable, UserLanguage, to manage selected language. My site assumes en-US as default language and the drop down is displayed on the login page. That means the user cannot change language on any page as, upon login page, a service retrieves available languages.
I'm using Master page and I've handled the menus, breadcrumb SiteMapPath, and LTR-RTL there.
On the actual page, here is a brief:
public partial class PublicLogOn : BaseWebForm
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Request.IsAuthenticated)
{
SiteLogger.NLogger.Info("Request Authenticated");
SiteLogin.RedirectToDefaultPage();
}
#region Handle Return URL
if (HttpContext.Current.Request.QueryString["ReturnUrl"] != null && !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["ReturnUrl"]))
{
var tempUrl = HttpContext.Current.Request.QueryString["ReturnUrl"];
SiteLogger.NLogger.Info("Return URL : " + tempUrl);
if (tempUrl.Contains(#"/SecuredArea/AdminArea/"))
{
buttonLogOn.Visible = false;
// buttonAdminLogOn.Visible = true;
}
else if (tempUrl.Contains(#"/SecuredArea/EmployeeArea/"))
{
buttonLogOn.Visible = true;
// buttonAdminLogOn.Visible = false;
}
else
{
// buttonLogOn.Visible = buttonAdminLogOn.Visible = true;
buttonLogOn.Visible = true;
}
}
#endregion
if (!Page.IsPostBack)
{
SiteLogger.NLogger.Info("Loading Languages and Directories");
// Actual language loading
if (!LoadLanguages() || !LoadDirectories())
{
SiteLogger.NLogger.Info("Loading Languages or Directories failed!");
return;
}
SiteLogger.NLogger.Info("Completed : PublicLogOn.PageLoad");
}
// Don't know why this fails and the drop-down still shows en-US even culture is ur-PK
//if (Session["UserLanguage"] != null)
//{
// DDLLanguages.SelectedValue = Session["UserLanguage"].ToString();
//}
}
catch (Exception ex)
{
SiteLogger.NLogger.Error("Error in PublicLogOn.Page_Load", ex.Message);
}
}
private Boolean LoadLanguages()
{
Boolean methodResult;
try
{
SiteLogger.NLogger.Info("In Load Languages");
// This line also mess up
// Session["UserLanguage"] = null;
DDLLanguages.Items.Clear();
var fetchedLanguages = UserManagePage.GetOrganizationLanguages();
foreach (var oneFetchedLanguage in fetchedLanguages)
{
DDLLanguages.Items.Add(new ListItem(oneFetchedLanguage.LanguageSymbol, oneFetchedLanguage.LanguageSymbol));
}
if (fetchedLanguages.Count() == 1)
{
DDLLanguages.Enabled = false;
}
methodResult = true;
}
catch (Exception exp)
{
SiteLogger.NLogger.Error("Error in load languages : ", exp.ToString());
labelMessage.Text = MessageFormatter.GetFormattedErrorMessage("Error retrieving organization languages.");
methodResult = false;
}
return methodResult;
}
private Boolean LoadDirectories()
{
// Nothing to-do with code-in-question
}
protected void ButtonLogOn_Click(object sender, EventArgs e)
{
// Nothing to-do with code-in-question
}
protected void DDLLanguages_SelectedIndexChanged(object sender, EventArgs e)
{
Session["UserLanguage"] = DDLLanguages.SelectedValue;
// Reload-hack. Was recommended on SO.
Response.Redirect(Request.Url.AbsolutePath);
}
}
After all of this, there one more point where the session variable is used as read-only: I'm using a header to tell my server that the client's using xyz language and that server should return translated data, where applicable:
public class CustomInspectorBehavior : IClientMessageInspector, IEndpointBehavior
{
#region IClientMessageInspector
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
string languageIdentifier;
if (HttpContext.Current.Session["UserLanguage"] != null)
{
languageIdentifier = HttpContext.Current.Session["UserLanguage"].ToString();
}
else
{
languageIdentifier = CultureInfo.CurrentCulture.ToString();
}
var typedHeader = new MessageHeader<string>(languageIdentifier);
var untypedHeader = typedHeader.GetUntypedHeader("LanguageIdentifier", "");
request.Headers.Add(untypedHeader);
return null;
}
#endregion
#region IEndpointBehavior
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
var inspector = new CustomInspectorBehavior();
clientRuntime.MessageInspectors.Add(inspector);
}
#endregion
}
Results
Expected: I change the selected value on the drop-down and the page reload with new language + secure the selection in session. Now upon going to other pages, the new language is presented.
Actual: "LOL". I change the selected value from the default en-US to ur-PK and the web site updates to Urdu. All pages are in Urdu. I try to select en-US again and I realize I'm stuck with Urdu. The base page's InitializeCulture() trigger way too early and it finds Session["UserLanguage"] = ur-PK'. After that thePage_Loadof thePublicLogOnpage triggers effectively putting Drop down's selected value to still ur-PK. After thatDDLLanguages_SelectedIndexChangedof thePublicLogOn` page triggers updating the session variable to the selected value which is set to ur-PK from the recent PageLoad. Issue. The Hack triggers in the end repeating the cycle one more time.
I'm trying a number of things but end in this mini-loop. Any help will be appriciated.
You could do a redirect after your set the new language in the session.
I re-did the whole thing from scratch. Turns out there was one or two variables being static at IIS level which were the cause of all the pain.
Related
Creating an app that on tap of an webview input field, has to do an action. Catching and starting the selected action works fine, but due to it being started by clicking an input field, the keyboard is requested. On Android < Version 9, my currently code works just fine to hide the keyboard, but on Android Version 9, it doesn't.
I have tried all manor or combination of what was deemed the top answer on this post, but none have worked for my app on Android 9
Below is a bit of my code from my MainActivity, where the instance of my keyboard service implementation is created. the MainActivity code is then followed by my Keyboard service implementation made for android.
[Activity(Label = "Dental.App", Icon = "#mipmap/icon", Theme = "#style/MainTheme", MainLauncher = true, ScreenOrientation = ScreenOrientation.SensorLandscape,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, WindowSoftInputMode = SoftInput.StateAlwaysHidden) ]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
...
DependencyService.Get<IServiceCollection>().SetKeyboardService(new KeyboardService(this, GetInputMethodManager()));
...
}
public InputMethodManager GetInputMethodManager()
{
return (InputMethodManager)GetSystemService(Context.InputMethodService);
}
}
public class KeyboardService : IKeyboardService
{
private InputMethodManager inputMethodManager;
private readonly object mainActivity;
public KeyboardService(object activity, InputMethodManager methodManager)
{
mainActivity = activity;
inputMethodManager = methodManager;
}
public bool IsKeyboardShown => inputMethodManager.IsAcceptingText;
public void HideKeyboard()
{
if (inputMethodManager == null || !(mainActivity is Activity activity)) return;
Logging.Log(LogType.Information, $"Attempting to Hide Keyboard via 1st method...");
//var view = activity.CurrentFocus;
var view = activity.FindViewById(Android.Resource.Id.Content).RootView;
if (view == null) Logging.Log(LogType.Warning, $"Failed to get View from Activity...");
var token = view?.WindowToken;
if (token == null) Logging.Log(LogType.Warning, $"Failed to get Token from View...");
var success = inputMethodManager.HideSoftInputFromWindow(token, HideSoftInputFlags.None);
Logging.Log(LogType.Information,
$"{nameof(inputMethodManager.HideSoftInputFromWindow)} returned => {success}");
if(success) view?.ClearFocus();
if (!IsKeyboardShown)
{
view?.ClearFocus();
return;
}
Logging.Log(LogType.Warning,
$"Failed to Hide Keyboard via {nameof(inputMethodManager.HideSoftInputFromWindow)}...");
HideKeyboardAttemptTwo(activity);
}
private void HideKeyboardAttemptTwo(Activity activity)
{
Logging.Log(LogType.Information, $"Attempting to Hide Keyboard via 2nd method...");
//var view = activity.CurrentFocus;
var view = activity.FindViewById(Android.Resource.Id.Content).RootView;
if (view == null) Logging.Log(LogType.Warning, $"Failed to get View from Activity...");
var token = view?.WindowToken;
if (token == null) Logging.Log(LogType.Warning, $"Failed to get Token from View...");
inputMethodManager.ToggleSoftInputFromWindow(token, ShowSoftInputFlags.None, HideSoftInputFlags.None);
if (!IsKeyboardShown)
{
view?.ClearFocus();
return;
}
Logging.Log(LogType.Warning, $"Failed to Hide Keyboard via {nameof(inputMethodManager.ToggleSoftInputFromWindow)}...");
}
public void ReInitializeInputMethod()
{
inputMethodManager = InputMethodManager.FromContext((Context) mainActivity);
}
None of the null check are coming back true, i.e nothing is null. The variable called success in the method HideKeyboard is returning false in 99% of all cases where it is called on a android version 9. In the 1% of the cases where it is true, the keyboard is still open. If the keyboard is still shown at the end of HideKeyboard, then the code attempts to close the keyboard via toggling it in the method HideKeyboardAttemptTwo. Doing it either of theses ways on Android 9 does not work, however running the exact same code on an Android 7.1 works just fine.
I'm not entirely sure that i have implemented the use of ToggleSoftInputFromWindow correctly, it is intended to only be able to run when the keyboard is open, i.e always used to hide the keyboard.
To reiterate my question: How do it successfully hide the keyboard on an Android 9.
If any additional information is needed, just ask, and i will attempt to find and supply it.
I uses this for my app, give it a try
Interface in main project
namespace *.Services.Interfaces
{
public interface IForceKeyboardDismissalService
{
void DismissKeyboard();
}
}
Phone specific code
using Plugin.CurrentActivity; //Nugget used to get activity
[assembly: Xamarin.Forms.Dependency(typeof(AndroidForceKeyboardDismissalService))]
namespace *.Droid.PhoneSpecific
{
public class AndroidForceKeyboardDismissalService : IForceKeyboardDismissalService
{
public void DismissKeyboard()
{
var imm = InputMethodManager.FromContext(CrossCurrentActivity.Current.Activity.ApplicationContext);
imm?.HideSoftInputFromWindow(CrossCurrentActivity.Current.Activity.Window.DecorView.WindowToken, HideSoftInputFlags.NotAlways);
var currentFocus = CrossCurrentActivity.Current.Activity.CurrentFocus;
if (currentFocus != null && currentFocus is EditText)
currentFocus.ClearFocus();
}
}
}
Usage
DependencyService.Get<IForceKeyboardDismissalService>().DismissKeyboard();
Let me know if its working for you.
To fix my problem i injected some JavaScript into the Webview, wherein i unfocused the input field, that was clicked.
On my Webview class i created a method that, given the string id of an element, would toggle whether or not that element is focused. As a second input, a boolean can be supplied, but defaulted to True, to indicate whether or not, you only want to unfocus the element.
public class AdvancedWebView : HybridWebView
{
...
public void ToggleElementFocus(string elementId, bool onlyUnFocus = true)
{
var js = GetJsInvertFocus(elementId, onlyUnFocus);
InjectJavaScript(js);
// Logging.Logging.Log(LogType.Information, $"Injected Javascript => {js}");
}
...
private string GetJsInvertFocus(string elementId, bool onlyUnFocus)
{
var builder = new StringBuilder();
builder.Append($"if (document.getElementById('{elementId}'))");
builder.Append("{");
builder.Append($"var element = document.getElementById('{elementId}');");
builder.Append($"if (element === document.activeElement)");
builder.Append("{");
builder.Append($"element.blur();");
builder.Append("}");
builder.Append($"else if({onlyUnFocus} == False)");
builder.Append("{");
builder.Append($"element.focus();");
builder.Append("}");
builder.Append("}");
return builder.ToString();
}
...
}
I'm extending the HybridWebview from XLabs, as it already has the functionality to inject JavaScript into the Webview. So that is where i get the InjectJavaScript method from.
On my page in my app, with the Webview, i then have a method that runs, when the element is clicked. To get a click event when clicking the Webview look at this link. During the method i figure out what the element id is from the event arguments, and then use this id to inject the JavaScript shown above, to unfocus the element, causing the keyboard to not appear at all. Below my OnClicked method can be seen.
public partial class DentalWebPage : AdvancedTabbedPage
{
...
private void DentalWebView_OnClicked(object sender, ClickEvent e)
{
try
{
if (LogUserPosition(sender, e)) return;
SwapToScanningTap();
}
catch (Exception ex)
{
Logging.Log(LogType.Exception,
ex.GetType().Namespace == typeof(BaseException).Namespace
? $"{ex.GetType()} => {ex}"
: $"{ex.GetType()} => {ex.Message}; Stacktrace => {ex.StackTrace}");
}
}
private bool LogUserPosition(object sender, ClickEvent e)
{
if (Config.DebugMode) Logging.Log(LogType.Debug, $"WebView was clicked...");
if (Config.DebugMode) Logging.Log(LogType.Debug, $"Element that was clicked is the following one => {e.Element}");
var success = Enum.TryParse(e.Element.Split(' ')[1].Split('=')[1], out clickedInputId);
if (!success && !(clickedInputId == InputId.MainContent_TextBoxInputStr ||
clickedInputId == InputId.MainContent_TextBoxScanOrder ||
clickedInputId == InputId.MainContent_TextBoxSelectProd ||
clickedInputId == InputId.MainContent_TextBoxStockReturn))
return true;
if (Config.DebugMode && webPageEnding == WebsiteControllers.Stock.ToString().ToLowerInvariant())
Logging.Log(LogType.Debug, $"WebView was clicked while on the stock page...");
return false;
}
private void SwapToScanningTap()
{
PerformOnMainThread(() =>
{
CurrentPage = Children[1];
ScanningToggle.IsToggled = true;
try
{
var isKeyboardShown = services.KeyboardService.IsKeyboardShown;
if (Config.DebugMode) Logging.Log(LogType.Debug, $"IsKeyboardShown returns => {isKeyboardShown}");
DentalWebView.ToggleElementFocus(clickedInputId.ToString());
}
catch (ObjectDisposedException)
{
if (DisposedReattempt) throw;
if (Config.DebugMode)
Logging.Log(LogType.Debug,
$"Input Method has been Disposed; Attempting to reinitialize it and rerun the {nameof(SwapToScanningTap)} method ones again");
DisposedReattempt = true;
services.KeyboardService.ReInitializeInputMethod();
SwapToScanningTap();
}
});
}
...
private void PerformOnMainThread(Action action)
{
try
{
Device.BeginInvokeOnMainThread(action);
}
catch (Exception ex)
{
Logging.Log(LogType.Exception,
ex.GetType().Namespace == typeof(BaseException).Namespace
? $"{ex.GetType()} => {ex}"
: $"{ex.GetType()} => {ex.Message}; Stacktrace => {ex.StackTrace}");
}
}
}
If you wish to get a understanding of the format of the string contained in e.Element, then go and look at the link supplied earlier.
Fell free to ask further questions, in case i missed something.
I have a WPF application and i am opening a drawing in AutoCAD from my application. I just wanted to restrict user to change current profile using set current button, and i didn't want to make profile changes in registry settings.
I find the answer finally, Just use UrrentProfileChangingEventHandler to show a popup and on CurrentProfileChangedEventHandler event make profile active which you want. Here is the code.
Put on initialize method
UserConfigurationManager bnb = Autodesk.AutoCAD.ApplicationServices.Core.Application.UserConfigurationManager;
bnb.CurrentProfileChanging += UserConfigManagerEvent_CurrentProfileChanging_Handler;
bnb.CurrentProfileChanged += UserConfigManagerEvent_CurrentProfileChanged_Handler;
Add method which is call on profile changing event
private void UserConfigManagerEvent_CurrentProfileChanging_Handler(object sender,ProfileEventArgs e)
{
string profileName = acApp.GetSystemVariable("CPROFILE").ToString();
curProfile = e.ProfileName;
if (profileName != curProfile && !IsMessageDisplayed)
{
IsMessageDisplayed = true;
MessageBox.Show("The selected profile is not associated with Project");
}
if (string.IsNullOrEmpty(prevProfile))
{
prevProfile = profileName;
}
}
Call after profile change event
private void UserConfigManagerEvent_CurrentProfileChanged_Handler(object sender, ProfileEventArgs e)
{
AcadApplication app = (AcadApplication)Application.AcadApplication;
AcadPreferences pref = app.Preferences;
string cur = curProfile;
if (curProfile.Equals(prevProfile))
{
IsMessageDisplayed = false;
return;
}
else
{
pref.Profiles.ActiveProfile = prevProfile;
}
}
New to IIS and Mongo, and I'm trying to find a way to clear the keys from my server to avoid an "item with the same key has already been added" exception.
IMongoDatabase _db;
IMongoCollection<BoardStorageItem> _boardsCollection;
public MongoDb()
{
var client = new MongoClient("mongodb://localhost");
_db = client.GetDatabase("KanbanDemonstration");
BsonClassMap.RegisterClassMap<CardStorageItem>();
BsonClassMap.RegisterClassMap<ColumnStorageItem>();
BsonClassMap.RegisterClassMap<BoardStorageItem>();
BsonClassMap.RegisterClassMap<EmployeeStorageItem>();
_boardsCollection = _db.GetCollection<BoardStorageItem>("Board");
}
public BoardStorageItem GetBoardByName(string name)
{
var board = _boardsCollection.AsQueryable().FirstOrDefault(b => b.Name == name);
return board;
}
public class MongoConverter
{
MongoDb _mongoDb;
public MongoConverter()
{
_mongoDb = new MongoDb();
}
public BoardStorageItem GetBoardByName(string name)
{
return _mongoDb.GetBoardByName(name);
}
}
and then for the code on the web page itself
protected void Button1_Click(object sender, EventArgs e)
{
_mongoConverter = new MongoConverter();
var board = _mongoConverter.GetBoardByName(TextBox1.Text);
BoardName = board.Name;
BoardId = board.Id;
Label3.Text = BoardName;
Label4.Text = BoardId;
Session.Clear();
}
This works perfectly this first time I use the button to get a board, but if I try a second time, I get an exception "item with the same key has already been added" when attempting to new up MongoConverter. I had thought that clearing the session after would clear out the keys as well, but the only thing that seems to work is resetting the server itself.
Calling BsonClassMap.RegisterClassMap<T>() should only be done once per type. And it should be done at application startup, before opening any database connections according to the documentation.
Since you're in ASP.NET, put this in your Application_Start event in your global application class (global.asax)
void Application_Start(object sender, EventArgs e)
{
BsonClassMap.RegisterClassMap<CardStorageItem>();
BsonClassMap.RegisterClassMap<ColumnStorageItem>();
BsonClassMap.RegisterClassMap<BoardStorageItem>();
BsonClassMap.RegisterClassMap<EmployeeStorageItem>();
}
You can make another method that calls it so you don't pollute your global application class if you want. And of course, remove the registrations from your constructor.
I am trying to restart my application and run a command. For example, when the user clicks the language he wants it goes checked true and ignores the other one with checked = false. When that is done, the application restarts and checks what language the users checked after the restart and gets the language.
public Application()
{
InitializeComponent();
check_language();
languages();
}
private void lang_english_Click(object sender, EventArgs e)
{
// problem *******
Application.Restart();
// if i remove this is works ok.
// when app is restarted it is like starting it so i dont think
// this works at all. is there an other way to read this?
// maybe with a bool?
lang_english.Checked = true;
//Ignore
lang_portuguese.Checked = false;
MessageBox.Show("Language was set to English.\r\nCliente will now restart.", "Language", MessageBoxButtons.OK, MessageBoxIcon.Information);
check_language();
}
private void lang_portuguese_Click(object sender, EventArgs e)
{
lang_portuguese.Checked = true;
//Ignore
lang_english.Checked = false;
MessageBox.Show("Language was set to Portuguese.\r\nCliente will now restart.", "Language", MessageBoxButtons.OK, MessageBoxIcon.Information);
check_language();
}
private void languages()
{
//Languages
}
}
private void check_language()
{
if (lang_english.Checked == true)
{
languages(); //Get the languages
//Ignore
lang_portuguese.Checked = false;
}
else if (lang_portuguese.Checked == true)
{
languages(); //Get the languages
//Ignore
lang_english.Checked = false;
}
}
First I would save the selected language in the app.config file, the you can check the config on start-up and check the appropriate language.
Second for restarting the application I would use one of two options:
1) Application.Restart()
2) Start a second application and then end the first. See this post: Restart WinForms Application
You may also want to look into changing the language at run-time Change language at run-time
You are checking your language AFTER restarting the application inside the SAME application controls. You should write and read the language in a file so you can check it in there:
private void lang_portuguese_Click(object sender, EventArgs e)
{
new System.IO.StreamWriter(new System.IO.FileStream("File.ext", System.IO.FileMode.Create)).Write("Portuguese");
}
private void check_language()
{
String lang = new System.IO.StreamReader("YouFile.ext").ReadLine();
if (lang == "English")
{
languages(); //Get the languages
//Ignore
lang_portuguese.Checked = false;
}
else if (lang == "Portuguese")
{
languages(); //Get the languages
//Ignore
lang_english.Checked = false;
}
}
This are EXAMPLES. you should write and read with validation and creating instances of your stream, so you close it after finishing Reading/writting.
This is the idea I can give you.
All!
I've website with multiples idioms. I can select/change idiom in any page. The idiom is saved in Session, if I change idiom, I changed session value.
The problem is:
If I change my default idiom in Homepage and go to other page, this session value is lost, consequently, this page not translated.
But if I reload this page one or more times, translates current page.
This occur just in Webserver (Pheonix - US). In localhost, session not lost value.
This issue occur to any page, but just in IE. To Chrome works correctly.
Below, my source code to Homepage. To all pages is basically this code.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//to set default session value. (first time).
if (Session["idioma"] == null)
{
string idioma = CultureInfo.CurrentCulture.TwoLetterISOLanguageName.ToString();
Idioma.MudaCultura(idioma);
Session["idioma"] = idioma;
}
//if I've other session value (Change Idiom).
else if (Session["idioma"] != null)
{
string idioma = Session["idioma"].ToString();
Idioma.MudaCultura(idioma);
}
lblWelcome.Text = Idioma.RetornaMensagem("welcome");
btnRequestAccess.Text = Idioma.RetornaMensagem("btnRequestAccess");
btnTickets.Text = Idioma.RetornaMensagem("btnTickets");
btnManager.Text = Idioma.RetornaMensagem("btnManager");
btnManageFolders.Text = Idioma.RetornaMensagem("btnManageFolders");
IdiomaList.Items.Add("PORTUGUÊS");
IdiomaList.Items.Add("ENGLISH");
IdiomaList.Items.Add("ESPAÑOL");
//Set value that show in DropDown list according to Session value.
if (Session["idioma"].ToString() == "pt")
{
IdiomaList.SelectedValue = "PORTUGUÊS";
}
else if (Session["idioma"].ToString() == "en")
{
IdiomaList.SelectedValue = "ENGLISH";
}
else if (Session["idioma"].ToString() == "es")
{
IdiomaList.SelectedValue = "ESPAÑOL";
}
}
}
protected void Idioma_OnChange(object sender, EventArgs e)
{
if (IdiomaList.SelectedValue == "PORTUGUÊS")
{
Idioma.MudaCultura("pt");
Session["idioma"] = "pt";
}
else if (IdiomaList.SelectedValue == "ENGLISH")
{
Idioma.MudaCultura("en");
Session["idioma"] = "en";
}
else if (IdiomaList.SelectedValue == "ESPAÑOL")
{
Idioma.MudaCultura("es");
Session["idioma"] = "es";
}
lblWelcome.Text = Idioma.RetornaMensagem("welcome");
btnRequestAccess.Text = Idioma.RetornaMensagem("btnRequestAccess");
btnTickets.Text = Idioma.RetornaMensagem("btnTickets");
btnManager.Text = Idioma.RetornaMensagem("btnManager");
btnManageFolders.Text = Idioma.RetornaMensagem("btnManageFolders");
}
I have experienced the same problem with IE losing the session each time the page reloads. In my case it was caused by the server having an out of sync timezone which caused the cookies to already be expired when it reached the client. It seems most browsers still work, whereas IE will destroy the cookies when navigating to the next page.
This can be a browser setting problem.
to solve this problem you can view as below link.
Cookie blocked/not saved in IFRAME in Internet Explorer
I hope it will helpful to you.