here is the c# code:
protected void Page_Load(object sender, EventArgs e)
{
if ((string)Session["admin"] == null)
{
mainF.InnerHtml = "<div id='inner' style='margin-left:370px; margin-top:80px;font: 0.92em arial,sans-serif;word-spacing: 2px;font-weight: bold;'>Your Are Not Supposed To Be Here.</div>";
}
}
public bool checkIfAllowed()
{
bool isIt = false;
if ((string)Session["admin"] != null && (string)Session["admin"] != "")
{
isIt = true;
}
return isIt;
}
so basicly I thought that I can somehow use jquery to call the checkIfAllowed() function to check whether the session exists or not, but i dont know how.
this is what i have:
if (!checkIfAllowed() /*which of course doesn't work*/) {
var inter = setInterval(function () {
window.location.replace("http://www.google.com");
}, 3000);
}
else {
clearInterval(inter);
}
there probably are other ways to do this, if you have a some solution please tell me. i guess i can also redirect the page with asp.net but it didn't work the first time. i also tried writing
$("#inner").html != null && $("#inner").html != ""
in the if() statement in the jquery, because #inner html is changing on pageLoad in asp.net.
thanks =]
Ps. i didn't know exacly what forum to write it in, maybe it better fits the asp.net one. If so, please move this topic.

New Topic/Question
Reply


MultiQuote




|