Hi,
I am trying getting value of session value from javascript. First time it not getting
but if I try second time it is getting becuase of first time session value is getting null
and second time value is storing which is i am trying of password. I can use hidden value
because of software auditing. I tyring getting value from 'Session["KEY"]' which i have
used in javascript. and i am using master page. so my script in master page
<asp:ToolkitScriptManager ID="tsmMains" runat="server" EnablePageMethods="true">
</asp:ToolkitScriptManager>
<script type="text/javascript">
function EncryptPassword() {
var key = '<%= Session["KEY"] %>';
if (!document.getElementById('<%=tbPassword.ClientID %>').value == '') {
var password = document.getElementById('<%=tbPassword.ClientID %>').value;
var encrypted = CryptoJS.TripleDES.encrypt(password, key);
document.getElementById('<%=tbPassword.ClientID %>').value = encrypted.toString();
InitializeRequest(password);
}
}
</script>
cs.code
=========
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.bLogin.Attributes.Add("onClick", "EncryptPassword()");
}
}
[WebMethod]
public static string SetDownloadPath(string strpath)
{
//Page objp;
//objp = new Page();
//objp.Session["KEY"] = strpath;
nMess = strpath;
return strpath;
}