Step 1. Create an ActionMethod / Function in the controller
public string IsUserLoggedIn()
{
if (Session["UserId"] != null)
return "true";
else
return "false";
}
Step 2: Create an ajax call. if returns true, then the user is not registered otherwise.
function IsUserLoggedIn() {
var lsValue = true;
$.ajax({
type: "Post",
url: "IsUserLoggedIn",
datatype: "json",
async: false,
success: function (foData) {
if (foData == "true")
lsValue = true;
else
lsValue = false;
},
error: function (xhr, ajaxOptions, thrownError) {
},
complete: function (e) {
}
});
return lsValue;
}
source
share