ASP.NET - back button event for login control - Asked By hiren dhameliya on 14-Apr-10 07:00 AM

in my application when i login in my application its login
when i cilck on logoutits .logout but i cilck on back button
it 's apper login page reply me asoonsa
Mash B replied to hiren dhameliya on 14-Apr-10 07:05 AM
What u do once login save some staus in session variable.

and in Login page , OnLoad event just check for that session variable status , and redirect it to perticular page

session["loggedIn"] = true;

if(session["loggedIn"] = true)
Web Star replied to hiren dhameliya on 14-Apr-10 07:08 AM

Simply put this javascript between your <head></head tags, and you're done:

 <script type="text/javascript" language="javascript">

Anand Malli replied to hiren dhameliya on 14-Apr-10 07:09 AM
hi hiren

hi there

there are servel options

1) Use Sessions so as soon as you logout your session will get expire,now if user presses back
   he/she must be redirected to login page

2) use javascript History class it has some usefull functionality like

3) use Response.Expires=-1 it will erase all cached pages

i hope that would help you out


Web Star replied to hiren dhameliya on 14-Apr-10 07:10 AM
also use this way

its' easy when you loggened  and come to your home page, there write java script liek this

<script type=javascript>
or else like this way here great sample

thank you
Goniey N (Mr. G) replied to hiren dhameliya on 14-Apr-10 08:16 AM
You Can Use Session For Global value.

When You Open Your Home Page Or Main Page You Have To First of All Set Your Session As "0", Means User Not Logged In.
Session("Login") = 0;
After That Check Condition

After Login By User Set It As "1".

Session("Login") = 1;

If (Session("Login")==0)
         MsgBox("Please Login.")
     //Means User Till Not Logged In.

When User Will Press On Logout Button Then Again Set it As "0".

Session("Login") = 0;

So, After Logout When User Will Press Back button It Will Ask Agian For The Login...

//It Will Work 100%...