I have a MVC web site with a httpGet function that do this
[HttpGet]
public JsonResult doSomething()
{
if(Session[SessionName.count] == null)
Session[SessionName.count] = 0;
Session[SessionName.count] += 1;
retu Json(Session[SessionName.count], JsonRequestBehavior.AllowGet);
}
in the site there is a javascript function do this
function testing(){
$.ajax({
url: "@Url.Action("doSomething", "Test")",
success: function (data) {
alert(data);
},
error: function (data) {
alert("error");
}
});
}
and finally in my web browser control
public void ShowCount()
{
browser.Document.InvokeScript("Testing");
}
everytime ShowCount() is call, the alert box in web browser control will always 1.
