I am working on application where i want to pass data from one to another using Cache. On First page which is an .aspx page iI have a textbox control and one button Control. On button control click event i have written following code:
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txtName.Text.Trim()))
{
Cache["Name"] = txtName.Text;
Response.Redirect("Test.html");
}
}
catch (Exception ex)
{
throw (ex);
}
}
Now on the Target page i.e Test.html i have written following code to get cache value
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
//var name = GetParameterValues('ID');
//var name = '<%= session.getAttribute("Name") %>';
var name = (string)["Name"];
alert(name);
});
but this code is not working. Please help me.