Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I have a text box in my Login Page, where i am giving it a value in the .aspx page i.e(hard coded). When i run this Page it is showing me the value of textbox that is "Office". Now Suppose if i change the value of textbox to "Home". For the Complete session, the value is persisting, but after the logout page When i again come to the login page, the value becomes "Office", but i want that the value should be "Home". Since i Am new to asp,, I am not able to find any solutions to it. Please help me.

Thanks in advance.
Posted
Comments
Rickin Kane 11-Sep-12 5:38am    
Are you killing the session when you log out , if yes then it will get the hardcoded value.
and what the purpose of showing the Home after you log out , u mean to say u dont want to kill the session of logged in user
Amit Roy 11-Sep-12 5:44am    
yes i am killing the session at logout. I need to kill the session at logout but i need the value of textbox to persist as well.
Rickin Kane 11-Sep-12 5:58am    
Simple then if that the case what u do is when u logout dont clear the session , Redirect to Login Page , in page Load of Login Page , u check if the Session key exists for Login name , if exists then set the value of textbox to session and then clear the session for further proceeding

Ankur\m/ 11-Sep-12 6:12am    
What does killing of session have to do here. Login page will always show the hard coded value irrespective of you keep the user session or kill it (unless changed on client side).
Rickin Kane 11-Sep-12 6:23am    
yes , since when the Login Page Load , he can check if session exists , if it exists then set the value in textbox in Page Load event , what i mean is , no need to hardcode , can do at code behind , check if session exists then set the value of session or set the custom value

Amit Roy wrote:
but after the logout page When i again come to the login page, the value becomes "Office"

Amit Roy wrote:
have a text box in my Login Page, where i am giving it a value in the .aspx page i.e(hard coded). When i run this Page it is showing me the value of textbox that is "Office".


On the login page you will always see it as "Office" irrespective of you logout and come to that page or you hit that page directly. And that's because you have hard-coded it. There is no role of session here as other people have said in their comment. You may have a different value on other pages, but login page will always show hard-coded value (unless you change it on client side).

To show a different value there you need to fetch that value from somewhere based on you logic rather than hard-coding it. Please elaborate on what you want exactly and we may be able to help.
 
Share this answer
 
move logic of button click to some function and use it also in pageload if not postback
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900