Solved

Session String[] Array?

Posted on 2012-03-22
5
214 Views
Last Modified: 2012-08-14
Q. How do I send & recieve a string[] in a Session?

string[] names = new string[3] {"Matt", "Joanne", "Robert"};

Session("nameArray") = names???
0
Comment
Question by:pointeman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
Umar Topia earned 500 total points
ID: 37751904
You can store anything in Session Varibale

However, while retrieving you will have to cast it in specific Type

string[] names = new string[3] {"Matt", "Joanne", "Robert"};

string[] strarrSessionNames = Session("nameArray") as string[];

or

string[] strarrSessionNames = (string[])(Session("nameArray"));
0
 
LVL 10

Expert Comment

by:Umar Topia
ID: 37751913
for storing it's a simply statement

string[] names = new string[3] {"Matt", "Joanne", "Robert"};

Session["nameArray"] = names;
0
 

Author Comment

by:pointeman
ID: 37755157
Okay, then access the info like:

string matt  = names[0].ToString();
string joanne  = names[1].ToString();
0
 
LVL 10

Expert Comment

by:Umar Topia
ID: 37755517
Yeah... once you get the array object
then you can play around with it in normal way
0
 

Author Closing Comment

by:pointeman
ID: 37759364
thx
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question