Solved

Session String[] Array?

Posted on 2012-03-22
5
213 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

Technology Partners: 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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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