C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

Is there any expert to solve this?


Posted Date: 13 Oct 2005      Posted By: maya      Member Level: Bronze     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

Author: HimaBindu Veeramachaneni    13 Oct 2005Member Level: DiamondRating: 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://dotnetspider.com/mentors/18-HimaBindu-Veeramachaneni.aspx?tab=details'



Author: Ramakrishna    13 Oct 2005Member Level: GoldRating: 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>");



Author: DotNET-Helper    13 Oct 2005Member Level: GoldRating: 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



Author: vipul patni    29 Dec 2008Member Level: BronzeRating: 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!!



Author: rahulagrawal    31 Dec 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 1

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


Author: B. Gopal Surya Prakash    12 Jan 2009Member Level: SilverRating: 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)



Author: Robin Thomas    27 Jan 2009Member Level: GoldRating: 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



Author: B. Gopal Surya Prakash    28 Jan 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 0

Response.Cache.SetCacheability(HttpCacheability.NoCache)


Author: A S H I S H    16 Feb 2009Member Level: GoldRating: 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 '



Author: Nagamohan kumar P    20 Feb 2009Member Level: GoldRating: 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: .NET



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use