Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
  #2 (permalink)  
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



  #3 (permalink)  
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:38 AM.


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