Hello!
I have a simple question.
Do we have session arrays that we can reference, assign, or select from?
Could I please have a sample of how this is done. The obvious syntax that I
am trying doesn't work. There are SA's in VB, but I am not seeing anything
for C#.
Thank you!
-Bahman 6 3774
Not sure if you are talking about the Session object. If so, in C#, we use
square brackets ([]) to access the session collection as in
Session["mykey"].
HTH
"Bahman" <Ba****@discuss ions.microsoft. com> wrote in message
news:A0******** *************** ***********@mic rosoft.com...
Hello!
I have a simple question.
Do we have session arrays that we can reference, assign, or select from?
Could I please have a sample of how this is done. The obvious syntax that I
am trying doesn't work. There are SA's in VB, but I am not seeing anything
for C#.
Thank you!
-Bahman
Perhaps if you showed us what syntax you were using that doesn't work, we
could be of more help.
I'm not sure what you mean by "session arrays"
In ASP.Net you have a session which you can access in c# such as:
Session["SomeUserId "] = 1;
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Bahman" <Ba****@discuss ions.microsoft. com> wrote in message
news:A0******** *************** ***********@mic rosoft.com... Hello!
I have a simple question.
Do we have session arrays that we can reference, assign, or select from?
Could I please have a sample of how this is done. The obvious syntax that I am trying doesn't work. There are SA's in VB, but I am not seeing anything for C#.
Thank you!
-Bahman
Karl,
In VB, you can say
session("array" ) (1) = "1"
session("array" ) (2) = "2"
In other words, the session object can be assigned a type other than the
basic types of numbers and strings, in this case an array.
I wonder if that can be done in c#. Obviously, I wouldn't know how to define
it since we don't explicity define session objects, I would think.
The syntax wouldn't need to be the same. For example, if I could create an
array, assign it to some kind of session object, create another array, and
assing the session object back to the other array, that would work too. I
wouldn't need the session variable itself to work like an array. But it would
be nice.
Also, all I am trying to do is use the array on a different page. If I can
make the array somehow persistent in some other way, that would be very ok as
well.
-Bahman
"Karl Seguin" wrote: Perhaps if you showed us what syntax you were using that doesn't work, we could be of more help.
I'm not sure what you mean by "session arrays"
In ASP.Net you have a session which you can access in c# such as:
Session["SomeUserId "] = 1;
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "Bahman" <Ba****@discuss ions.microsoft. com> wrote in message news:A0******** *************** ***********@mic rosoft.com... Hello!
I have a simple question.
Do we have session arrays that we can reference, assign, or select from?
Could I please have a sample of how this is done. The obvious syntax that I am trying doesn't work. There are SA's in VB, but I am not seeing anything for C#.
Thank you!
-Bahman
The only reason VB let's you do that, is because you have Option Strict Off.
Turn it on, and you will get a compile time error.
Always use option strict On, when you are using VB.
In either case (VB with option strict on, or C#), you need to case
session("array" ) to an array of whatever type is appropriate, and only then
can you access a particular item in the array.
"Bahman" <Ba****@discuss ions.microsoft. com> wrote in message
news:13******** *************** ***********@mic rosoft.com... Karl,
In VB, you can say
session("array" ) (1) = "1" session("array" ) (2) = "2"
In other words, the session object can be assigned a type other than the basic types of numbers and strings, in this case an array.
I wonder if that can be done in c#. Obviously, I wouldn't know how to define it since we don't explicity define session objects, I would think.
The syntax wouldn't need to be the same. For example, if I could create an array, assign it to some kind of session object, create another array, and assing the session object back to the other array, that would work too. I wouldn't need the session variable itself to work like an array. But it would be nice.
Also, all I am trying to do is use the array on a different page. If I can make the array somehow persistent in some other way, that would be very ok as well.
-Bahman
"Karl Seguin" wrote:
Perhaps if you showed us what syntax you were using that doesn't work, we could be of more help.
I'm not sure what you mean by "session arrays"
In ASP.Net you have a session which you can access in c# such as:
Session["SomeUserId "] = 1;
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "Bahman" <Ba****@discuss ions.microsoft. com> wrote in message news:A0******** *************** ***********@mic rosoft.com... > Hello! > > I have a simple question. > > Do we have session arrays that we can reference, assign, or select > from? > > Could I please have a sample of how this is done. The obvious syntax > that > I > am trying doesn't work. There are SA's in VB, but I am not seeing > anything > for C#. > > Thank you! > > -Bahman
Marina,
This is outstanding.
I only have one question for you.
How do I 'case' a session variable to become an array in c#?
Could you please point me to a page or site with samples or definitions?
Thank you very much for your help!
-Bahman
"Marina" wrote: The only reason VB let's you do that, is because you have Option Strict Off. Turn it on, and you will get a compile time error.
Always use option strict On, when you are using VB.
In either case (VB with option strict on, or C#), you need to case session("array" ) to an array of whatever type is appropriate, and only then can you access a particular item in the array.
"Bahman" <Ba****@discuss ions.microsoft. com> wrote in message news:13******** *************** ***********@mic rosoft.com... Karl,
In VB, you can say
session("array" ) (1) = "1" session("array" ) (2) = "2"
In other words, the session object can be assigned a type other than the basic types of numbers and strings, in this case an array.
I wonder if that can be done in c#. Obviously, I wouldn't know how to define it since we don't explicity define session objects, I would think.
The syntax wouldn't need to be the same. For example, if I could create an array, assign it to some kind of session object, create another array, and assing the session object back to the other array, that would work too. I wouldn't need the session variable itself to work like an array. But it would be nice.
Also, all I am trying to do is use the array on a different page. If I can make the array somehow persistent in some other way, that would be very ok as well.
-Bahman
"Karl Seguin" wrote:
Perhaps if you showed us what syntax you were using that doesn't work, we could be of more help.
I'm not sure what you mean by "session arrays"
In ASP.Net you have a session which you can access in c# such as:
Session["SomeUserId "] = 1;
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!) "Bahman" <Ba****@discuss ions.microsoft. com> wrote in message news:A0******** *************** ***********@mic rosoft.com... > Hello! > > I have a simple question. > > Do we have session arrays that we can reference, assign, or select > from? > > Could I please have a sample of how this is done. The obvious syntax > that > I > am trying doesn't work. There are SA's in VB, but I am not seeing > anything > for C#. > > Thank you! > > -Bahman
string[] cough = (string[])Session["SomeArrayK ey"];
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Bahman" <Ba****@discuss ions.microsoft. com> wrote in message
news:37******** *************** ***********@mic rosoft.com... Marina,
This is outstanding.
I only have one question for you.
How do I 'case' a session variable to become an array in c#?
Could you please point me to a page or site with samples or definitions?
Thank you very much for your help!
-Bahman
"Marina" wrote:
The only reason VB let's you do that, is because you have Option Strict Off. Turn it on, and you will get a compile time error.
Always use option strict On, when you are using VB.
In either case (VB with option strict on, or C#), you need to case session("array" ) to an array of whatever type is appropriate, and only then can you access a particular item in the array.
"Bahman" <Ba****@discuss ions.microsoft. com> wrote in message news:13******** *************** ***********@mic rosoft.com... > Karl, > > In VB, you can say > > session("array" ) (1) = "1" > session("array" ) (2) = "2" > > In other words, the session object can be assigned a type other than > the > basic types of numbers and strings, in this case an array. > > I wonder if that can be done in c#. Obviously, I wouldn't know how to > define > it since we don't explicity define session objects, I would think. > > The syntax wouldn't need to be the same. For example, if I could create > an > array, assign it to some kind of session object, create another array, > and > assing the session object back to the other array, that would work too. > I > wouldn't need the session variable itself to work like an array. But it > would > be nice. > > Also, all I am trying to do is use the array on a different page. If I > can > make the array somehow persistent in some other way, that would be very > ok > as > well. > > -Bahman > > "Karl Seguin" wrote: > >> Perhaps if you showed us what syntax you were using that doesn't work, >> we >> could be of more help. >> >> I'm not sure what you mean by "session arrays" >> >> In ASP.Net you have a session which you can access in c# such as: >> >> Session["SomeUserId "] = 1; >> >> Karl >> >> -- >> MY ASP.Net tutorials >> http://www.openmymind.net/ - New and Improved (yes, the popup is >> annoying) >> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to >> come!) >> "Bahman" <Ba****@discuss ions.microsoft. com> wrote in message >> news:A0******** *************** ***********@mic rosoft.com... >> > Hello! >> > >> > I have a simple question. >> > >> > Do we have session arrays that we can reference, assign, or select >> > from? >> > >> > Could I please have a sample of how this is done. The obvious >> > syntax >> > that >> > I >> > am trying doesn't work. There are SA's in VB, but I am not seeing >> > anything >> > for C#. >> > >> > Thank you! >> > >> > -Bahman >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fnark! |
last post by:
I am creating a shopping cart using PHP Version 4.1.2. I am creating and
registering a cart object in a session. The cart object contains an array of
arrays called $order whose elements are a collection of $orderline
associative arrays which, in turn, hold the global POST values key
'order_code' and value 'qty' as passed in from another page.
My problem is (shown by using print_r to print out the contents of the
arrays) each time I...
|
by: Don Grover |
last post by:
Does any one have an asp page they can share that returns current session
details, cookies etc.
I can't get session arrays to return in a page.
|
by: John |
last post by:
Hi all,
I've got an issue with session variables in asp pages. I need to make a
decision that I think you can hopefully help me out here.
When a session starts on the iss server I need to store some information in
some session variables. But this information is coming from an old dbase
system. In the beginning of this project it was just a simple static array
of information. Afterwards it turns out that this must be a dynamic array...
|
by: please-answer-here |
last post by:
I want to store a bunch of textstrings (about 500) returned from a database
query in a session array. I've googled all over the net, not to find any
working method.
Is there anybody who has the ultimative, definite working method as to how
you transfer a "local" array to a session array and later transfer the
session array to a "local" array.
regards
Henning
|
by: adam |
last post by:
Having spent nearly 2 years in win forms land the inevitable request came
for me to "do some web pages".
So being new to this bit of .net and having had a look around I can't see
where the best way to store session data.
1) use the (string)Session approach
Obviously bad for maintenance, readability etc.
2) have a typed MySession object with static properties for each value I
want to store
| |
by: Michaelk |
last post by:
Can somebody tell me how many Session variables would be considered
exessive, and when they start really affect the server speed.
For example on 20-30 asp pages I need to use about 200-300 session variables
and 5 arrays by 1000 elements 50 characters long each.
Let say having 300 users using those pages at the same time.
Server is not the fastest one, just CPU 2.40GHz.
So question is as a user am I going to feel a difference in speed...
|
by: jwhite68 |
last post by:
The essence of my problem is this.
1. I login to my website with user/password.
2. I select any option, which effectively re-calls index2.php with some additional parameters, to control whats displayed next. Immediately at this point, it logs out the user.
It is logging out the user because after checking $_SESSION == '1' - it finds that its not 1, and therefore displays login section again and a related message.
The website is being...
|
by: sjsean |
last post by:
All thanks in advance for reading my post. I am new to using js and
more accustomed to vbscript.
I had written code which created a shopping cart into an array using
vbscript and then transferred the information into a session
variable. However what I didn't know was that deleting/manipulating
information in an array using vbscript was not that easy.
In doing some reading and research it seemed that js was more flexible
in this...
|
by: TheServant |
last post by:
Is there any problem with using session.auto_start in the php.ini instead of declaring session_start() on every page?
Also, can sessions store arrays, and if so, is this a good idea?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |