Home All Groups Group Topic Archive Search About

How to use session variables?



Author
20 Sep 2006 3:23 PM
Me
I am unable to pass the values using session variables.
Here is what I tried thus far -

1. In the 1st program I have created a session variable called name
Session.Name= <the value I would like to pass>

2. In the next program how do I use it?

I tried a few things but it doesn't work.

Thanks for your  help in advance.

-Me

Author
20 Sep 2006 4:22 PM
CJM
"Me" <M*@discussions.microsoft.com> wrote in message
news:AE70CB38-63D3-4615-9E70-C8E12EA364F9@microsoft.com...
>
> 1. In the 1st program I have created a session variable called name
> Session.Name= <the value I would like to pass>
>

Session("Name") = "My Name"

> 2. In the next program how do I use it?
>

Response.Write "My Name is " & Session("Name")

> I tried a few things but it doesn't work.
>

You might want to try a few more. Session variables aren't the best way to
pass variables from page to page - they can quickly suck up your servers
resources, even in a very modest application.. You could use querystrings,
forms or storing your session state in a database.

> Thanks for your  help in advance.
>

Not probs.

CJM
Author
20 Sep 2006 5:47 PM
Me
CJM,

Thanks for the reply!
Where can I find the doc on creating and using session variables?
In our case resources isn't an issue (at least now).

Thank you,
-Me


Show quote
"CJM" wrote:

>
> "Me" <M*@discussions.microsoft.com> wrote in message
> news:AE70CB38-63D3-4615-9E70-C8E12EA364F9@microsoft.com...
> >
> > 1. In the 1st program I have created a session variable called name
> > Session.Name= <the value I would like to pass>
> >
>
> Session("Name") = "My Name"
>
> > 2. In the next program how do I use it?
> >
>
> Response.Write "My Name is " & Session("Name")
>
> > I tried a few things but it doesn't work.
> >
>
> You might want to try a few more. Session variables aren't the best way to
> pass variables from page to page - they can quickly suck up your servers
> resources, even in a very modest application.. You could use querystrings,
> forms or storing your session state in a database.
>
> > Thanks for your  help in advance.
> >
>
> Not probs.
>
> CJM
>
>
>
Author
20 Sep 2006 6:03 PM
Bob Barrows [MVP]
The documentation for ASP is here:
http://msdn.microsoft.com/library/en-us/iissdk/html/2c40c3cf-90eb-41ca-ae2a-0ef33a651779.asp

But there really isn't much to using session variables, as long as you
remember that they are application-specific. Check the documentaion to
clarify application boundaries. At its simplest, all pages in a virtual
directory belong to the same application.

Me wrote:
Show quote
> CJM,
>
> Thanks for the reply!
> Where can I find the doc on creating and using session variables?
> In our case resources isn't an issue (at least now).
>
> Thank you,
> -Me
>
>
> "CJM" wrote:
>
>>
>> "Me" <M*@discussions.microsoft.com> wrote in message
>> news:AE70CB38-63D3-4615-9E70-C8E12EA364F9@microsoft.com...
>>>
>>> 1. In the 1st program I have created a session variable called name
>>> Session.Name= <the value I would like to pass>
>>>
>>
>> Session("Name") = "My Name"
>>
>>> 2. In the next program how do I use it?
>>>
>>
>> Response.Write "My Name is " & Session("Name")
>>
>>> I tried a few things but it doesn't work.
>>>
>>
>> You might want to try a few more. Session variables aren't the best
>> way to pass variables from page to page - they can quickly suck up
>> your servers resources, even in a very modest application.. You
>> could use querystrings, forms or storing your session state in a
>> database.
>>
>>> Thanks for your  help in advance.
>>>
>>
>> Not probs.
>>
>> CJM

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

AddThis Social Bookmark Button