Click here to Skip to main content
15,885,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sir i have 2 variables for storing session value of user name and password and get these value on another page but my question is this sir how can i with the help of 1 variable.
i want use single variables to use store the value of username and password and extract the value of another page please help me
Posted
Updated 20-Aug-14 23:07pm
v2

1 solution

You may join the username and password with a separator .

Consider the following example
ajay~welcome
ajay is the username
~ is the separator
welcome is the password

now you may store the concatinated value in a session and on the next page split the value on the separator '~' and use the 0th index of the array as your username, 1st index of the array as the password.

Hope this helps.
 
Share this answer
 
Comments
Rahulmishra011 21-Aug-14 5:14am    
sir but may password also have "~" sign so sir its not properly extract
Sanchayeeta 21-Aug-14 5:18am    
Then use some other character.
ChauhanAjay 21-Aug-14 5:21am    
it was just and example you may also use a combination of special characters as a separator like '~!@#$%' Now you will say that these characters may exists in the password but they may not exists in the order in which you have given.
Rahulmishra011 21-Aug-14 5:30am    
ok i will try with this way but i want use collection (array list) where i can store the user name and password
ChauhanAjay 21-Aug-14 5:38am    
if you are pretty sure u only want username and password then you can also use an array.
In the 0th index store the username and password in the 1st index.

This will also help.

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