Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 4th, 2007, 12:25 AM
Authorized User
 
Join Date: Jan 2007
Location: Islamabad, Punjab, Pakistan.
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aliirfan84
Default LogOff problem in Page

I m using MasterPage in my application. I put LogOff button in masterpage so that it become visible on all pages inherited from master page. The problem is that when I click on LogOff button it moves to login page but on clicking Back button of IE last page come again from chache. Code against logoff is as

{
   Session.Abondend();
   Response.Redirect("login.aspx");
}

 Also each paeg contains following code in Page_Load

{
  if(Session["id"].Equal(""))
  {
  -------
  }
  else
  {
    Response.Redirect("login.aspx");
  }

}
Please tell me how to solve this problem. Also tell me is there any way to clear chache??


__________________
Regards,
Ali Irfan
 
Old May 6th, 2007, 02:45 PM
Registered User
 
Join Date: Apr 2007
Location: Mexico DF, , Mexico.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to elmemo
Default

Hi,
   I don't think clearing the cache is what you want. What I think you want is for certain pages to be served only if you have the appropriate cookie.
You can easily do this by placing the pages you want protected under a directory, and then specify that directory to have an authorisation scheme that only allows authenticated users to log in (you would do this in web.config) this would definately not allow you to view a page even if you hit the "back" button once you signed out.

    To destroy the auth cookie I use FormsAuthentication.SignOut()

the code you have put in page_load is unnecessary. Try to use FormsAuthentication.SetAuthCookie method. This way your app will use web.config to determine whether the page should be served to the user, not your code in page_load.

I recommend you read about forms authentication in .NET cause your doing it the classic ASP way. here's a good read: http://www.15seconds.com/issue/020220.htm



 
Old May 6th, 2007, 04:56 PM
Authorized User
 
Join Date: Sep 2006
Location: Belgrade, Serbia, Yugoslavia.
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to VerbatimBOT Send a message via Yahoo to VerbatimBOT
Default

In order to clear the page from the cache, put this line of code in the Page_Load event
Code:
Response.Cache.SetCachebility(NoCache)
Something like that, i wrote this without checking...

e-ducan Global Store
Programmer/Application developer
http://www.e-ducan.com
Belgrade, Serbia




Similar Threads
Thread Thread Starter Forum Replies Last Post
Trace logoff error l.wolf Oracle 0 June 7th, 2007 05:10 AM
Server sent email requires client logoff - why? VictorVictor ASP.NET 2.0 Professional 6 April 11th, 2007 09:50 AM
Logoff User Help ali786 Classic ASP Databases 1 March 31st, 2005 01:27 PM
Logoff user using ASP: ali786 Classic ASP Databases 5 March 21st, 2005 12:34 PM
How Do I Restart MySQL After Logoff/Logon spjewett Beginning PHP 6 March 29th, 2004 04:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.