Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Difference between Session["var"] and Session("var")

Reply
Thread Tools

Difference between Session["var"] and Session("var")

 
 
thomson
Guest
Posts: n/a
 
      06-20-2005
Hi,
i create a session variable in C# as follows Session["var"] ,
but iam not able to access the variable in VB.net

like intmode=Session("var");

Why is that ?

Regards

thomson

 
Reply With Quote
 
 
 
 
thomson
Guest
Posts: n/a
 
      06-20-2005

iam not getting an error but while i retrieve the value somtething like
this

if session("module")="" then
intmodle=50
else
intmodle=session("module")
end if

when i come to the first "if " it skips and no statement is executed

One morething can i add querystring variable to a Server.transfer
method
regards

thomson
Eliyahu Goldin wrote:
> Do you get any error?
>
> Eliyahu
>
> "thomson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > Hi,
> > i create a session variable in C# as follows Session["var"] ,
> > but iam not able to access the variable in VB.net
> >
> > like intmode=Session("var");
> >
> > Why is that ?
> >
> > Regards
> >
> > thomson
> >


 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      06-20-2005
thomson wrote:
> Hi,
> i create a session variable in C# as follows Session["var"] ,
> but iam not able to access the variable in VB.net
>
> like intmode=Session("var");
>
> Why is that ?
>
> Regards
>
> thomson


It's just syntax:
in C# you use [ ]
in VB you use ( )

apart from that, it's identical.

Hans Kesting


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      06-20-2005
Do you have a particular message or does it come "empty" ?

If the later, it's likely you have two sessions (check SessionID). This is
likely not a problem with the programming language but rather with how you
lannch these two pages (you could use the same language in both to see if
it's still shows the same problem).

Patrice

--

"thomson" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed) ups.com...
> Hi,
> i create a session variable in C# as follows Session["var"] ,
> but iam not able to access the variable in VB.net
>
> like intmode=Session("var");
>
> Why is that ?
>
> Regards
>
> thomson
>



 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      06-20-2005
Use Response.write to see which branch is executed. Also dump the content
and use Response.Write(Session("module")="") to see what happens.

For now all the code you show reads the variable. How do you create it ?

I ask this because you said previously you *create* a session variable as
follows :
intmode=Session("var");

It doesn't create a session variable, it reads it.

Patrice

--

"thomson" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed) oups.com...
>
> iam not getting an error but while i retrieve the value somtething like
> this
>
> if session("module")="" then
> intmodle=50
> else
> intmodle=session("module")
> end if
>
> when i come to the first "if " it skips and no statement is executed
>
> One morething can i add querystring variable to a Server.transfer
> method
> regards
>
> thomson
> Eliyahu Goldin wrote:
> > Do you get any error?
> >
> > Eliyahu
> >
> > "thomson" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed) ups.com...
> > > Hi,
> > > i create a session variable in C# as follows Session["var"] ,
> > > but iam not able to access the variable in VB.net
> > >
> > > like intmode=Session("var");
> > >
> > > Why is that ?
> > >
> > > Regards
> > >
> > > thomson
> > >

>



 
Reply With Quote
 
thomson
Guest
Posts: n/a
 
      06-20-2005

Hi,
Actually the issue is that i do have a page with several buttons ,
when i click a button i call a javascript to open a new window with a
query string value.

The new window has 3 frames before itself i retrieve the query string
value into a session like Session["module"].

But one of the left frame is written in VB.net where it access the
Session Variable.

In order to avoid a new open window , and i used Server.transfer to the
frame page, But nothing is coming



Regards

thomson

Patrice wrote:
> Do you have a particular message or does it come "empty" ?
>
> If the later, it's likely you have two sessions (check SessionID). This is
> likely not a problem with the programming language but rather with how you
> lannch these two pages (you could use the same language in both to see if
> it's still shows the same problem).
>
> Patrice
>
> --
>
> "thomson" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed) ups.com...
> > Hi,
> > i create a session variable in C# as follows Session["var"] ,
> > but iam not able to access the variable in VB.net
> >
> > like intmode=Session("var");
> >
> > Why is that ?
> >
> > Regards
> >
> > thomson
> >


 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-20-2005
Do you get any error?

Eliyahu

"thomson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hi,
> i create a session variable in C# as follows Session["var"] ,
> but iam not able to access the variable in VB.net
>
> like intmode=Session("var");
>
> Why is that ?
>
> Regards
>
> thomson
>



 
Reply With Quote
 
thomson
Guest
Posts: n/a
 
      06-20-2005
Hi all

this is what i did

try
{
Server.Transfer("MainForm.aspx?module=50");
}
catch(Exception objEx)
{
Response.Write(objEx.Message);
}

In the MainForm.aspx

i do have a code <%Session["module"]=Request.QueryString["module"];%>

and an exception is raised in the code

What could be the reason

Regards

thomson

thomson wrote:
> Hi,
> Actually the issue is that i do have a page with several buttons ,
> when i click a button i call a javascript to open a new window with a
> query string value.
>
> The new window has 3 frames before itself i retrieve the query string
> value into a session like Session["module"].
>
> But one of the left frame is written in VB.net where it access the
> Session Variable.
>
> In order to avoid a new open window , and i used Server.transfer to the
> frame page, But nothing is coming
>
>
>
> Regards
>
> thomson
>
> Patrice wrote:
> > Do you have a particular message or does it come "empty" ?
> >
> > If the later, it's likely you have two sessions (check SessionID). Thisis
> > likely not a problem with the programming language but rather with how you
> > lannch these two pages (you could use the same language in both to see if
> > it's still shows the same problem).
> >
> > Patrice
> >
> > --
> >
> > "thomson" <(E-Mail Removed)> a écrit dans le message de
> > news:(E-Mail Removed) ups.com...
> > > Hi,
> > > i create a session variable in C# as follows Session["var"] ,
> > > but iam not able to access the variable in VB.net
> > >
> > > like intmode=Session("var");
> > >
> > > Why is that ?
> > >
> > > Regards
> > >
> > > thomson
> > >


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      06-20-2005
Please avoid mixing distinct questions in the same thread...

1) For session have you checked SessionID to see if you actually have two
distincts sessions
2) Server.Transfer is server side. You don't transmit parameters this way.
Either use Response.Redirect or see :
http://www.dotnetbips.com/displayarticle.aspx?id=79
(parameters are exposed through properties from the source page and read
from the destination page through Context.Handler to get access to the
source page).

Patrice


--

"thomson" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed) ups.com...
Hi all

this is what i did

try
{
Server.Transfer("MainForm.aspx?module=50");
}
catch(Exception objEx)
{
Response.Write(objEx.Message);
}

In the MainForm.aspx

i do have a code <%Session["module"]=Request.QueryString["module"];%>

and an exception is raised in the code

What could be the reason

Regards

thomson

thomson wrote:
> Hi,
> Actually the issue is that i do have a page with several buttons ,
> when i click a button i call a javascript to open a new window with a
> query string value.
>
> The new window has 3 frames before itself i retrieve the query string
> value into a session like Session["module"].
>
> But one of the left frame is written in VB.net where it access the
> Session Variable.
>
> In order to avoid a new open window , and i used Server.transfer to the
> frame page, But nothing is coming
>
>
>
> Regards
>
> thomson
>
> Patrice wrote:
> > Do you have a particular message or does it come "empty" ?
> >
> > If the later, it's likely you have two sessions (check SessionID). This

is
> > likely not a problem with the programming language but rather with how

you
> > lannch these two pages (you could use the same language in both to see

if
> > it's still shows the same problem).
> >
> > Patrice
> >
> > --
> >
> > "thomson" <(E-Mail Removed)> a écrit dans le message de
> > news:(E-Mail Removed) ups.com...
> > > Hi,
> > > i create a session variable in C# as follows Session["var"] ,
> > > but iam not able to access the variable in VB.net
> > >
> > > like intmode=Session("var");
> > >
> > > Why is that ?
> > >
> > > Regards
> > >
> > > thomson
> > >



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      06-20-2005
This could be because Session("module") is null.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"thomson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>
> iam not getting an error but while i retrieve the value somtething like
> this
>
> if session("module")="" then
> intmodle=50
> else
> intmodle=session("module")
> end if
>
> when i come to the first "if " it skips and no statement is executed
>
> One morething can i add querystring variable to a Server.transfer
> method
> regards
>
> thomson
> Eliyahu Goldin wrote:
>> Do you get any error?
>>
>> Eliyahu
>>
>> "thomson" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) ups.com...
>> > Hi,
>> > i create a session variable in C# as follows Session["var"] ,
>> > but iam not able to access the variable in VB.net
>> >
>> > like intmode=Session("var");
>> >
>> > Why is that ?
>> >
>> > Regards
>> >
>> > thomson
>> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 04-15-2011 04:00 AM
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 01-06-2011 05:00 PM
difference between between these "char"s arnuld C++ 33 03-05-2007 03:11 PM
Difference between bin and obj directories and difference between project references and dll references jakk ASP .Net 4 03-22-2005 09:23 PM
Exact difference between 'const char *' and 'char *', also diff between 'const' and 'static' Santa C Programming 1 07-17-2003 02:10 PM



Advertisments