Last post Aug 16, 2011 09:26 AM by GaneshNET
Aug 16, 2011 05:48 AM|savindrasingh|LINK
I am using a modal popup control (AJAX) to capture UserID, Password & DomainName from the user. These credentials are further used in C# code to do a WMI query to remote servers. The values are then assigned/stored in String variables in C# code.
string Passwrd = txtPassword.Text;
string UID = txtUserID.Text;
string DomainName = ddlDomain.SelectedValue;
The problem I am facing is: after PostBack, these variables are loosing their values and users of this website need to provide the credentials after each postback.
How do I preserve the values for the variables in each user sesstion?
NOTE: I can not use viewstate for security reasons.
Aug 16, 2011 05:57 AM|shashankgwl|LINK
assing them to Session variables.
Session["Passwrd"] = txtPassword.Text;
Session["UID"] = txtUserID.Text;
Session["DomainName"] = ddlDomain.SelectedValue;
Aug 16, 2011 06:02 AM|sovitmittal|LINK
Yes, in session variable you can preserve the value after postback but it would be server side.. but if you preserve at client side then use the Hidden field or cookies for the same
Aug 16, 2011 09:26 AM|GaneshNET|LINK
You could use viewstate or session objects to persist items. One of the feature given by microsoft is "User Interface Process Application Block" This will persist the values and also restores them after the postback