Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,496 members, 7,808,838 topics. Date: Thursday, 25 April 2024 at 05:45 PM

Help Needed! Expiring An Asp.net Page - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help Needed! Expiring An Asp.net Page (1219 Views)

Please Help, Java Applet And Asp.net Page / How Can I Add An Editor In The Textarea In An ASP.NET MVC Application / C# - Capturing File Name From A FileUpload Control In Asp.net (2) (3) (4)

(1) (Reply) (Go Down)

Help Needed! Expiring An Asp.net Page by khuna(f): 11:58am On Mar 06, 2009
Am on an asp.net project but am having problem expiring my previous page. thats wen the user login, he/she shud'nt be able to go back and view the login details.
Re: Help Needed! Expiring An Asp.net Page by dammytosh: 2:20pm On Mar 06, 2009
Are u using asp.net membership / role provider or u are authenticating and storing the login details in session ?

if u are storing ur login details in a session object, put this code on the page u want to expire

On the .aspx page, add this to the second line "<%@ OutputCache Location="None" %>"
that statement will force the browser to reload from the server whenever a back button is clicked

on ur code page, under ur Page Load event, put a logic that tests for login details in the session object and redirect as required. remember to test for (Not IsPostBack) so that ur logic works only if the user requested for the page afresh nt after a post back

If that doesn't help then u probably need to clarify ur questions very well. Tell us what u are trying to achieve and the language u are using.
I hope that helps
Re: Help Needed! Expiring An Asp.net Page by Kobojunkie: 3:14pm On Mar 06, 2009
Diable ViewState on those controls . Optionally, you can define Clear() methods that , upon successfully login, clear the values of those controls.
Re: Help Needed! Expiring An Asp.net Page by dammytosh: 4:25pm On Mar 06, 2009
Kobojunkie:

Disable [b]ViewState [/b]on those controls.

That won't work in this case.

View state comes to play when the server does a round trip. (i.e post back) so that the control can retain its previous state. Clicking the "Back Button" on your web browser will not call any server side code and hence there is no effect of Disabling or enabling view state on the control.
   The page will still be active and all your controls will have their values because ordinarily when u click back button on the page, it gets a copy from the cache. but adding this code <%@ OutputCache Location="None" %>  to the second line of ur aspx page will tell the browser not to cache the page and hence the page will expire in an attempt to reload.

  (Here i am talking asp.net)
Re: Help Needed! Expiring An Asp.net Page by Kobojunkie: 5:44pm On Mar 06, 2009
@Poster, Disable ViewState on those controls . Optionally, you can define Clear() methods that , upon successfully login, clear the values of those controls.
Re: Help Needed! Expiring An Asp.net Page by Bossman(m): 7:29pm On Mar 06, 2009
Disable caching if it's a web application. Don't know about asp, but with a jsp/html we do something like this. You should be able to do its equivalent on your end.

<meta http-equiv="Expires" content="-1"/>
<meta http-equiv="Cache-Control" content="no-cache">
Re: Help Needed! Expiring An Asp.net Page by Gomez(m): 10:55am On Mar 07, 2009
There many ways you can do this, some the former posters have
explained. But it all depends on the actual scenario that you are handling

1. Assuming that you are using the login control from asp.net
you may want to handle the [b]LoggedIn [/b]event(" This event gets fired when the user is authenticated"wink
inside the function you clear the fields.

2. if you generally want to prevent previous page movement in your entire application
here you might consider the use of client side code.
the window.history object provides an object  you can manipulate for this purpose.

you may want to read this article for detailed explanation of how to handle these issues

http://www.4guysfromrolla.com/webtech/111500-1.2.shtml

Thanks

(1) (Reply)

Pls Can Anyone Help Me With Mac Softwares: / Learn Php In Less Than 3weeks / Parse Error: Syntax Error, Unexpected T_else In C:\

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.