RSS Forums RSS
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 2640 | Replies: 10
Reply
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Back button in browser

  #1  
Jan 30th, 2008
If i click the back button in browser i got some problem.
i click the login and redirected to another page.after that i click the back btn its navigated to login page.but it didnt clear my session value login=true.still that user in login stage but that login page looking normal that is it contains menu.. login..signup. if i click any other page it contains menu ..logout.

i used some server side and client side code but there is no improvement.

If i click the back btn,i dont want any navigation.its in current page or refresh the current page.Is there any other way to achieve this result. or Is there any other way for proper navigation
Last edited by nandhinijp : Jan 30th, 2008 at 3:15 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Back button in browser

  #2  
Jan 30th, 2008
two ways to do this:

Put in your sub prerender ... end sub location one of these two choices.

Session.Abandon() which ends all session variables

or

If Session("login") = True Then response.redirect("correctpage.aspx")
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: Back button in browser

  #3  
Jan 31st, 2008
I tried this one in page prerender
If Session("login") = True Then response.redirect("correctpage.aspx")
but page cannot be displayed at first time load. tell me detail.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Back button in browser

  #4  
Jan 31st, 2008
The stages of loading a page with subs follows:

Page Initialization (Page_Init)
Page Loading (Page_Load)
Page Pre Rendering Phase (Page_PreRender)
Page Rendering (Page_Render) (This is rarely used, as the page is being rendered to the client)
Page Unloading (Page_UnLoad)

For this, you should put it in Page_init. It is the first thing being called and you don't have to waste server load and time building the page and shooting all functions/subs just to find out it needs to redirect. If you have the information before the page loads, then use it!

When a user logs on, set the : Session("login") = "True"

Then on page_init, check for: if Session("login") = "True" then response.redirect("page.aspx")

PreRender is the last stage before the client sees the page. This is when you want to do stuff to the web page that you had to wait for page_load to shoot.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Back button in browser

  #5  
Jan 31st, 2008
Oh and sorry about telling you prerender before

meant page_init.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: Back button in browser

  #6  
Feb 1st, 2008
Sorry I couldnt get.Once again i will explain my need.
If session[login]=true,At that time i click the back btn in my web page,its stay in that page no need navigation .if its not possible just refersh the page.
If session value not equal to true there is normal navigation.

for example now i an in home page i click the contact page in menu,redirect to that page.there is no login=true.i click the back btn.naviagted to home page.k

Next i used my login details in home page and redirected to one X page after login.In that X page i click the contact in menu.but didnt load and redirect to contact page from X page.I am using this in
Page_Init of contact page
{
if ((string)Session["login"] == "true")
{
Response.Redirect("conta.aspx", false);
}
Is it correct ?
In this place my actual need is redirect to contact page in that page i click back btn.its stay in same page.here didnt load contact page. what to do.
and also ont thing In some pages i want to navigate use back btn if login=true
I want to use this init fun in some of the pages particluarly after the login page.coz after login they use only logout.thats only clear all session variable .if use back btn redirect to login session values not clear.


Do u understand my pbm?


Is there any other way to clear session values particularly after the login page back btn use.
Till that navigation is no problem in site.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: Back button in browser

  #7  
Feb 1st, 2008
Hi I got one solution.Please check it,
After Login bt click its not directly redirect to X page .Now i am using another one page between login and X page just for redirection.its solved my problem.is it K.
So i click in back btn in X page its just refresh the X page.
Last edited by nandhinijp : Feb 1st, 2008 at 4:11 am.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: Back button in browser

  #8  
Feb 1st, 2008
Hi I got one solutionPlease chech it,
After Login bt click its not directly redirect to X page .Now i am using another one page between login and X page just for redirection.its solved my problem.is it.
So i click the back btn in X page its just refresh the X page.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: Back button in browser

  #9  
Feb 1st, 2008
Hi I got one solution.Please check it,
After Login bt click its not directly redirect to X page .Now i am using another one page between login and X page just for redirection.its solved my problem.is it K.
So i click the back btn in X page its just refresh the X page.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Back button in browser

  #10  
Feb 1st, 2008
that sounds fine, but you can use the same code on the redirect page on the login page. There should be no reason you cannot. However, if it works, it works!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:54 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC