ChangeLocalSite is javascript method and it is available only on "that" html page. But the Session["localSite"] is in the (web)server.
To set Session variable you may have to execute a server method from javascript. This only possible way of doing this through ajax call. Donot be scared of ajax. It is very easy to learn and use an ajax method.
here is an example using jquery:
public void ChangeLocalSite(String value)
{
$.ajax({
url: "MyMethod",
dataType: 'json',
type: 'POST',
data:value,
success: function (data) {
if (data != null)
alert(data);
}
}
});
}
[HttpPost]
string MyMethod(string value)
{
Session["localSite"] = value;
return "found it!";
}