This is a cheat, but you can do this, send the value to sever side as a parameter
<script>
var myVar = "hello"
window.location.href = window.location.href.replace(/[\?#].*|$/, "?param=" + myVar); //Send the variable to the server side
</script>
And from the server side, retrieve the parameter
string myVar = Request.QueryString["param"];
Session["SessionName"] = myVar;
hope this helps