Subscribe to Subscribers

Online Members

Shahbaz Ahmed
More...

Forums » .NET » .NET »

Is there any expert to solve this?


Posted Date: 13 Oct 2005      Posted By:: maya     Member Level: Bronze    Member Rank: 0     Points: 5   Responses: 10



I am doing an application in which a user have to login to do some particular operations ...

my question is ...if the user sign out from the application but he did not close the browser window ..then if he press the back button of the browser window he will see his personal page from which he had been logged out ..how can I prevent this.




Responses

#31877    Author: HimaBindu Vejella      Member Level: Gold      Member Rank: 42     Date: 13/Oct/2005   Rating: 2 out of 52 out of 5     Points: 2

To prevent this u can make the Page_Load event to occur whenever a back button is clicked so that u can make the necessary validations.

U can do this by simply implementing the following piece of code in page_load

Response.Cache.SetCacheability(HttpCacheability.NoCache)

This will make the cache empty and whenever the back button is pressed it fires the Page_Load event.
Try this and let me know whether it works or not

http://himabinduvejella.blogspot.com
http://sysntaxhelp.com/asp.net
http://groups.google.com/group/mugh
Hima's Tech Blog


 
#31878    Author: Ramakrishna      Member Level: Gold      Member Rank: 572     Date: 13/Oct/2005   Rating: 2 out of 52 out of 5     Points: 2

hi
add the following code in each and every page load event

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);

or

add the following code in logout page


Response.Write("<script language=javascript>var wnd=window.open('','newWin','height=1,width=1,left=900,top=700,status=no,toolbar=no,menubar=no,scrollbars=no,maximize=false,resizable=1');</script>");
Response.Write("<script language=javascript>wnd.close();</script>");
Response.Write("<script language=javascript>window.open('Login.aspx','_parent',replace=true);</script>");


 
#31889    Author: DotNET-Helper      Member Level: Gold      Member Rank: 0     Date: 13/Oct/2005   Rating: 2 out of 52 out of 5     Points: 2

Hi,

Use

Session.Abandon()
Session.Clear()
FormsAuthentication.SignOut()
Response.Redirect("~/Default.aspx?signout=1")

in the signout button and login use FormsAuthentication.loginurl()

Happy Coding





 
#332954    Author: vipul patni      Member Level: Bronze      Member Rank: 0     Date: 29/Dec/2008   Rating: 2 out of 52 out of 5     Points: 2

Well u can use this javascript to solve this problem! Use this javascript on Logout.asp or .aspx page.

<script language="JavaScript">
javascript:window.history.forward(1);
</script>

Whenever user will click Back button , he will be forwarded to logout page again!!


 
#333871    Author: rahulagrawal      Member Level: Silver      Member Rank: 0     Date: 31/Dec/2008   Rating: 2 out of 52 out of 5     Points: 1

just use window.history.forward(1); on the main page or page before logout page.

 
#336788    Author: B. Gopal Surya Prakash      Member Level: Silver      Member Rank: 862     Date: 12/Jan/2009   Rating: 2 out of 52 out of 5     Points: 2

good solution is to place the following code in page_load event & hope this would work for u:

Response.Cache.SetCacheability(HttpCacheability.NoCache)


 
#340814    Author: Robin Thomas      Member Level: Gold      Member Rank: 0     Date: 27/Jan/2009   Rating: 2 out of 52 out of 5     Points: 2

If you disable the cache for all the pages, it will affect the performance of the site considerably. So i always prefer to use javascript instead of setting the cache to NoCache.

Robin Thomas
Freelancer
visit for fresher jobs


 
#340932    Author: B. Gopal Surya Prakash      Member Level: Silver      Member Rank: 862     Date: 28/Jan/2009   Rating: 2 out of 52 out of 5     Points: 0

Response.Cache.SetCacheability(HttpCacheability.NoCache)

 
#347566    Author: A S H I S H      Member Level: Gold      Member Rank: 0     Date: 16/Feb/2009   Rating: 2 out of 52 out of 5     Points: 1

Hi ,

Hope it will help ...

Response.Cache.SetCacheability(HttpCacheability.NoCache)

good luck!
Ashish

Warm Regards
Ashish Tiwari
'Rome was not built in a day '


 
#349272    Author: Nagamohan kumar P      Member Level: Gold      Member Rank: 1146     Date: 20/Feb/2009   Rating: 2 out of 52 out of 5     Points: 2

This is the Java Script for that

in your html code Block

Script :--

<script language="JavaScript">

-- you can prevent going either ways by using the code line

window.history.forward(x);
x is 1,2...
</script>


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Previous : what is difference between String and string(data type) in c#?
Return to Discussion Forum
Post New Message
Category:

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2013 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.