Saturday, March 31, 2012
Session tracked via URL in ASP.NET
I have my asp.net web application to track session id across pages using the url, and not cookies, ie in the web.config file:
<sessionState .... cookieless="true" ...... />
however each link in the page does not embed the id in the url like it is supposed to :
<a href="http://links.10026.com/?link=http://mywebserver/(rqe4ptb333ojxz3kh1t3xqr3)/mypage.aspx"> my link </a>
and so each page i travel to, a new session id is created in the url and the information associated with the previous page's session id is lost.
can anybody tell me what else i need to do to make this work?
thank you,
Kenton Taylorfor some reason the .net framework will not insert the session id before rendering the HTML if your HREF uses a "/" to denote that the path is relative to the root
this will work:
href="http://myserver/home.aspx"
as will this:
href="home.aspx"
but this won't:
href="/home.aspx"
Session values across subdomains
I.e
If I have a site "shop.com" and when user acess his personal page it's
"secure.shop.com"
Is it possible to share the session values between these two?
Why I ask is because the hosting company gives a discount on SSL
certificates if I put it at secure.shop.com instead of the entire site
and since I only need checkout and personal info pages to be secure I
was thinking that I could put that info in the secure.shop.com domain
but I am worried I will loose session info like cartid, userid and
such..
Regards,
Danielit depends. to share the session cookie, you override the domain in the
session cookie, pretty simple. if secure.shop.com and shop.com are the
same site then you are done. if they are different sites and you use
inproc session, then you will need some way to pass session data from
one site to another (say a web service).
-- bruce (sqlwork.com)
daniel.westerberg@.ruilong.se wrote:
> Is it possible to keep sessions between subdomains?
> I.e
> If I have a site "shop.com" and when user acess his personal page it's
> "secure.shop.com"
> Is it possible to share the session values between these two?
> Why I ask is because the hosting company gives a discount on SSL
> certificates if I put it at secure.shop.com instead of the entire site
> and since I only need checkout and personal info pages to be secure I
> was thinking that I could put that info in the secure.shop.com domain
> but I am worried I will loose session info like cartid, userid and
> such..
> Regards,
> Daniel
Thursday, March 29, 2012
Session values across subdomains
I.e
If I have a site "shop.com" and when user acess his personal page it's
"secure.shop.com"
Is it possible to share the session values between these two?
Why I ask is because the hosting company gives a discount on SSL
certificates if I put it at secure.shop.com instead of the entire site
and since I only need checkout and personal info pages to be secure I
was thinking that I could put that info in the secure.shop.com domain
but I am worried I will loose session info like cartid, userid and
such..
Regards,
Danielit depends. to share the session cookie, you override the domain in the
session cookie, pretty simple. if secure.shop.com and shop.com are the
same site then you are done. if they are different sites and you use
inproc session, then you will need some way to pass session data from
one site to another (say a web service).
-- bruce (sqlwork.com)
daniel.westerberg@.ruilong.se wrote:
Quote:
Originally Posted by
Is it possible to keep sessions between subdomains?
I.e
If I have a site "shop.com" and when user acess his personal page it's
"secure.shop.com"
Is it possible to share the session values between these two?
Why I ask is because the hosting company gives a discount on SSL
certificates if I put it at secure.shop.com instead of the entire site
and since I only need checkout and personal info pages to be secure I
was thinking that I could put that info in the secure.shop.com domain
but I am worried I will loose session info like cartid, userid and
such..
>
Regards,
Daniel
Session values across subdomains
I.e
If I have a site "shop.com" and when user acess his personal page it's
"secure.shop.com"
Is it possible to share the session values between these two?
Why I ask is because the hosting company gives a discount on SSL
certificates if I put it at secure.shop.com instead of the entire site
and since I only need checkout and personal info pages to be secure I
was thinking that I could put that info in the secure.shop.com domain
but I am worried I will loose session info like cartid, userid and
such..
Regards,
Danielit depends. to share the session cookie, you override the domain in the
session cookie, pretty simple. if secure.shop.com and shop.com are the
same site then you are done. if they are different sites and you use
inproc session, then you will need some way to pass session data from
one site to another (say a web service).
-- bruce (sqlwork.com)
daniel.westerberg@.ruilong.se wrote:
> Is it possible to keep sessions between subdomains?
> I.e
> If I have a site "shop.com" and when user acess his personal page it's
> "secure.shop.com"
> Is it possible to share the session values between these two?
> Why I ask is because the hosting company gives a discount on SSL
> certificates if I put it at secure.shop.com instead of the entire site
> and since I only need checkout and personal info pages to be secure I
> was thinking that I could put that info in the secure.shop.com domain
> but I am worried I will loose session info like cartid, userid and
> such..
> Regards,
> Daniel
Session Variable across applications
persist if I like between the two applications?That's 'link' between two applications.
DogBoy,
I'd say yes
Cheers Al
As long as they're under the same website in IIS.
This doesn't seem to be working, the session variable is coming up null when I try to
jump applications in the same website. Any ideas?
Damn, looks like I was wrong. You can not share session variables across apps. You will need to pass them across using encrypted querystrings, post requests, and the like.
I'm not sure I fully understand what you're trying to do. This is what I think you're doing, let me know if this is not right -
your main site has a url like this
www.mysite.com
Note: This assumes you don't have extra domain names set up, trying to keep it simple!
To access app 1 you'd enter www.mysite.com/app1
To access app 1 you'd enter www.mysite.com/app2
If this is what you're doing then I know that cookies and session variables can definitely be shared because I'm doing it with a project I'm currently working on.
Cheers Al
That's what I'm trying to do - but the session variables are not jumping apps. The apps are configured in IIS, are yours configured that way or just sub directories?
I was thinking of using cookies, I know they are persistent but apparantly not session variables.
Mine are sub folder under the main site.
So I guess that's the end of that
I was thinking of what aconybeare mentioned here too, but then I realized you're talking about virtual directories, which are basically separate ASP.NET applications.
Monday, March 26, 2012
session variable lost across different folders
A session variable that I have created can only be shared by the pages within the same directory where the page containing the session variable is sitting. Once I redirect the page to another page outside the folder (a different folder), the session variable is lost (empty). I understood that a session variable is meant to be used across all files in an application. Am I missing something here? Or I didn't setup properly?
Please help.
ThanksIs is useable throughout and application. IE if you have an application directory called /myapp then all folders under that directory will accept the session variable. (I think). There are a number of ways to get around this. If you tell me were the 2 differnt folders are located,(relative to eachother). and what kind of value you are trying to pass I'll be able to help you.
One last thing: what kinda of script are you trying to write? login page, shopping cart, etc...
Ryder
Thanks Ryder!
I have an application folder called 'QSAConnect' and under this folder there are several sub-folders. The page with the session variable called Session("StudentID") is saved in a sub-folder called 'AbsRecordEntry', and I want to redirect this page to another page, called absreport.aspx, which requires this Session("StudentID") as a passing parameter for all the functions. The target page(absreport.aspx) is located in a sub-directory called 'AbsReport'. Here is the code:
Sub btnViewReport_Click(sender As Object, e As EventArgs)
Dim strStudentID as string
strStudentID=lbxStudentLastName.Items(lbxStudentLastName.SelectedIndex).Value
Session("StudentID") = strStudentID
response.redirect(".../AbsReport/absreport.aspx")End Sub
This produced an empty session variable when the absreport.aspx loaded. But if I place the file absreport.aspx under AbsRecordEntry folder and change code to:
response.redirect("absreport.aspx")
there is no problem.
I hope you can understand my explanation.
Thanks again
Haiyi
hmmm, I created a similar situation on my testing server a few minutes ago and it worked fine. But what I did notice is that i wrote my response.redirect line a bit differntly and I think that may be it.
see, here is how you wrote yours: response.redirect(".../AbsReport/absreport.aspx")
and this is how I wrote mine: response.redirect("../AbsReport/absreport.aspx")
notice I only have 2 periods not 3. So my next step was to try my code with 3 periods. It generated an error, so i beleive that may be it. The only onther thing I could think of off the top of my head was that maybe the folder AbsRecordEntry or AbsReport is also an application directory. because this would cause a problem perhaps.
Let me know if this works.
Ryder
Saturday, March 24, 2012
Session Variable Values Across HTTP/HTTPS
page like http://www.my_site.com/catalog.aspx to
https://www50.ssldomain.com/my_site/login.aspx and vice versa.
Are session variables suppose to lose values across different domain names?
The www50.ssldomain.com is hosted by the same webhost. It's just how they
handle their SSL certificate.
Help! Thanks for any help.
KenAcross domains? Yes. What happens, client side, is there are two server
cookies sent. This is quite normal and part of the "security" built into
browsers.
If you have a persistant store (database, for example), store values in the
database. On the same machine, you can sometimes get away with equivalent
machine keys, but cross domain is still a difficulty. The persistant store
overcomes this, as you can look up values as a user moves from site to site.
This is best if you go to cookieless authentication (which munges in the
session key).
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"MisterKen" wrote:
> It appears that I'm losing values for session variables when I move from a
> page like http://www.my_site.com/catalog.aspx to
> https://www50.ssldomain.com/my_site/login.aspx and vice versa.
> Are session variables suppose to lose values across different domain names
?
> The www50.ssldomain.com is hosted by the same webhost. It's just how they
> handle their SSL certificate.
> Help! Thanks for any help.
> Ken
Thanks for the clarification.
Do you know of a webpage that might demonstrate this?
"Cowboy (Gregory A. Beamer) - MVP" wrote:
> Across domains? Yes. What happens, client side, is there are two server
> cookies sent. This is quite normal and part of the "security" built into
> browsers.
> If you have a persistant store (database, for example), store values in th
e
> database. On the same machine, you can sometimes get away with equivalent
> machine keys, but cross domain is still a difficulty. The persistant store
> overcomes this, as you can look up values as a user moves from site to sit
e.
> This is best if you go to cookieless authentication (which munges in the
> session key).
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
>
> "MisterKen" wrote:
>
Session Variable Values Across HTTP/HTTPS
page like http://www.my_site.com/catalog.aspx to
https://www50.ssldomain.com/my_site/login.aspx and vice versa.
Are session variables suppose to lose values across different domain names?
The www50.ssldomain.com is hosted by the same webhost. It's just how they
handle their SSL certificate.
Help! Thanks for any help.
KenAcross domains? Yes. What happens, client side, is there are two server
cookies sent. This is quite normal and part of the "security" built into
browsers.
If you have a persistant store (database, for example), store values in the
database. On the same machine, you can sometimes get away with equivalent
machine keys, but cross domain is still a difficulty. The persistant store
overcomes this, as you can look up values as a user moves from site to site.
This is best if you go to cookieless authentication (which munges in the
session key).
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"MisterKen" wrote:
> It appears that I'm losing values for session variables when I move from a
> page like http://www.my_site.com/catalog.aspx to
> https://www50.ssldomain.com/my_site/login.aspx and vice versa.
> Are session variables suppose to lose values across different domain names?
> The www50.ssldomain.com is hosted by the same webhost. It's just how they
> handle their SSL certificate.
> Help! Thanks for any help.
> Ken
Thanks for the clarification.
Do you know of a webpage that might demonstrate this?
"Cowboy (Gregory A. Beamer) - MVP" wrote:
> Across domains? Yes. What happens, client side, is there are two server
> cookies sent. This is quite normal and part of the "security" built into
> browsers.
> If you have a persistant store (database, for example), store values in the
> database. On the same machine, you can sometimes get away with equivalent
> machine keys, but cross domain is still a difficulty. The persistant store
> overcomes this, as you can look up values as a user moves from site to site.
> This is best if you go to cookieless authentication (which munges in the
> session key).
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
>
> "MisterKen" wrote:
> > It appears that I'm losing values for session variables when I move from a
> > page like http://www.my_site.com/catalog.aspx to
> > https://www50.ssldomain.com/my_site/login.aspx and vice versa.
> > Are session variables suppose to lose values across different domain names?
> > The www50.ssldomain.com is hosted by the same webhost. It's just how they
> > handle their SSL certificate.
> > Help! Thanks for any help.
> > Ken
Session variable value resets
variable value I set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to its original value, the one I had set it before in the previous
trip sortcommand event handler.
I am trying to implement bidirectional sorting on a datagrid by making
use of session variable Session("SDirection"). In the sortcommand
event handler I check for its value and change it to DESC if its ASC
and vice-versa as follows:
Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
value to be the same that it was before I had made the change.
In the web.config the session configuration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
If any one has had the same issue then please share.
thanks.On Apr 3, 12:03 pm, aamirghan...@.gmail.com wrote:
> Hi, I need to know if anyone else came across this. The Session
> variable value I set in a sortCommand event handler of a datagrid does
> not hold on till the next sortcommand event handler and reverts back
> to its original value, the one I had set it before in the previous
> trip sortcommand event handler.
> I am trying to implement bidirectional sorting on a datagrid by making
> use of session variable Session("SDirection"). In the sortcommand
> event handler I check for its value and change it to DESC if its ASC
> and vice-versa as follows:
> Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
> "ASC")
> For the sake of simplicity I am not checking for the column in the
> above code ... just the direction.
> It sorts the dgrid fine for that pass, but next time a column (or same
> column) header is clicked then in the sortcommand handler I find the
> value to be the same that it was before I had made the change.
> In the web.config the session configuration looks like this:
> <sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
> This app was originally in .Net 1.1 and was working perfectly fine
> (and is on the 1.1 framework), but after converting it to 2.0 it has
> lost this functionality.
> If any one has had the same issue then please share.
> thanks.
A couple of things I would look at right off the bat:
1. Double-check the *case* of the characters in the keys you're using
to reference the items in the session. I'm not sure if the code sample
above was pasted in, or typed from memory; I know I've run into issues
due to case-sensitivity with session keys. That is, Session("a") !=
Session("A").
2. Are you checking for the key's existence prior to retrieval? Try
setting a breakpoint, drop out to the command window in Visual Studio
and iterate over the Session.KeyNames collection and see if it's
there. It would be interesting to see if the key got dropped or
possibly overwritten.
Just a few things I can think of right off the top of my head.
Mike
It would seem to me that the easiest way to figure out what's happening is t
o
run this in debug mode with a breakpoint on your line of code that does the
check and makes the change to the Session variable's value.
You can examine the values and the logic each time your breakpoint is hit.
Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"aamirghanchi@.gmail.com" wrote:
> Hi, I need to know if anyone else came across this. The Session
> variable value I set in a sortCommand event handler of a datagrid does
> not hold on till the next sortcommand event handler and reverts back
> to its original value, the one I had set it before in the previous
> trip sortcommand event handler.
> I am trying to implement bidirectional sorting on a datagrid by making
> use of session variable Session("SDirection"). In the sortcommand
> event handler I check for its value and change it to DESC if its ASC
> and vice-versa as follows:
> Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
> "ASC")
> For the sake of simplicity I am not checking for the column in the
> above code ... just the direction.
> It sorts the dgrid fine for that pass, but next time a column (or same
> column) header is clicked then in the sortcommand handler I find the
> value to be the same that it was before I had made the change.
> In the web.config the session configuration looks like this:
> <sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
> This app was originally in .Net 1.1 and was working perfectly fine
> (and is on the 1.1 framework), but after converting it to 2.0 it has
> lost this functionality.
> If any one has had the same issue then please share.
> thanks.
>
On Apr 3, 1:08 pm, "Mike Hofer" <kchighl...@.gmail.com> wrote:
> On Apr 3, 12:03 pm, aamirghan...@.gmail.com wrote:
>
>
>
>
>
>
>
>
> A couple of things I would look at right off the bat:
> 1. Double-check the *case* of the characters in the keys you're using
> to reference the items in thesession. I'm not sure if the code sample
> above was pasted in, or typed from memory; I know I've run into issues
> due to case-sensitivity withsessionkeys. That is,Session("a") !=Session("A
").
> 2. Are you checking for the key's existence prior to retrieval? Try
> setting a breakpoint, drop out to the command window in Visual Studio
> and iterate over theSession.KeyNames collection and see if it's
> there. It would be interesting to see if the key got dropped or
> possibly overwritten.
> Just a few things I can think of right off the top of my head.
> Mike- Hide quoted text -
> - Show quoted text -
Thanks Mike,
I have replaced all occurrences of Session("SDirection") with
Session("SDirection") throughout the project through IDE so I can be
sure they all are of the same case.
Any way it is the same event handler that sets and then retrieves the
value in the next trip. therefore case sensitivity should not be an
issue.
Also I have looked for the clause "Session("SDirection") =" so that I
can be sure there is no other part of the code in between thats
changing the session value.
I am pretty sure that the key does not get dropped, as it is still
bringing up the old value and not totally nulling it (at least I am
not getting "object reference not set error")
thanks for the feedback again.
On Apr 3, 3:25 pm, aamirghan...@.gmail.com wrote:
> On Apr 3, 1:08 pm, "Mike Hofer" <kchighl...@.gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Thanks Mike,
> I have replaced all occurrences of Session("SDirection") with
> Session("SDirection") throughout the project through IDE so I can be
> sure they all are of the same case.
> Any way it is the same event handler that sets and then retrieves the
> value in the next trip. therefore case sensitivity should not be an
> issue.
> Also I have looked for the clause "Session("SDirection") =" so that I
> can be sure there is no other part of the code in between thats
> changing the session value.
> I am pretty sure that the key does not get dropped, as it is still
> bringing up the old value and not totally nulling it (at least I am
> not getting "object reference not set error")
> thanks for the feedback again.- Hide quoted text -
> - Show quoted text -
Found the solution:
The dgrid was being sorted twice hence the Sortcommand was being
called twice and I would see the final sorted result. Session variable
SDirection was being set twice first from ASC to DESC and then back
again to ASC. therefore I would not see any change in the sort order.
All this was happening because the sortcommand event handler was
mentioned twice. Once declared in the onSortCommand attribute of the
datagrid in te aspx page and then again by adding "Handles
dgrid.SortCommand" in the definition of the actual event handler in
codefile.
Thanks.
On Apr 3, 3:25 pm, aamirghan...@.gmail.com wrote:
> On Apr 3, 1:08 pm, "Mike Hofer" <kchighl...@.gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Thanks Mike,
> I have replaced all occurrences of Session("SDirection") with
> Session("SDirection") throughout the project through IDE so I can be
> sure they all are of the same case.
> Any way it is the same event handler that sets and then retrieves the
> value in the next trip. therefore case sensitivity should not be an
> issue.
> Also I have looked for the clause "Session("SDirection") =" so that I
> can be sure there is no other part of the code in between thats
> changing the session value.
> I am pretty sure that the key does not get dropped, as it is still
> bringing up the old value and not totally nulling it (at least I am
> not getting "object reference not set error")
> thanks for the feedback again.- Hide quoted text -
> - Show quoted text -
Found the solution:
The dgrid was being sorted twice hence the Sortcommand was being
called twice and I would see the final sorted result. Session
variable
SDirection was being set twice first from ASC to DESC and then back
again to ASC. therefore I would not see any change in the sort order.
All this was happening because the sortcommand event handler was
mentioned twice. Once declared in the onSortCommand attribute of the
datagrid in te aspx page and then again by adding "Handles
dgrid.SortCommand" in the definition of the actual event handler in
codefile.
I checked the 1.1 code which still sorts fine even it had the event
handler mentoned twice. Is this new behavior in 2.0 a bug or by
design?
Thanks.
Session variable value resets
variable value I set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to its original value, the one I had set it before in the previous
trip sortcommand event handler.
I am trying to implement bidirectional sorting on a datagrid by making
use of session variable Session("SDirection"). In the sortcommand
event handler I check for its value and change it to DESC if its ASC
and vice-versa as follows:
Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
value to be the same that it was before I had made the change.
In the web.config the session configuration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
If any one has had the same issue then please share.
thanks.On Apr 3, 12:03 pm, aamirghan...@.gmail.com wrote:
Quote:
Originally Posted by
Hi, I need to know if anyone else came across this. The Session
variable value I set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to its original value, the one I had set it before in the previous
trip sortcommand event handler.
>
I am trying to implement bidirectional sorting on a datagrid by making
use of session variable Session("SDirection"). In the sortcommand
event handler I check for its value and change it to DESC if its ASC
and vice-versa as follows:
Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
value to be the same that it was before I had made the change.
>
In the web.config the session configuration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
>
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
>
If any one has had the same issue then please share.
>
thanks.
A couple of things I would look at right off the bat:
1. Double-check the *case* of the characters in the keys you're using
to reference the items in the session. I'm not sure if the code sample
above was pasted in, or typed from memory; I know I've run into issues
due to case-sensitivity with session keys. That is, Session("a") !=
Session("A").
2. Are you checking for the key's existence prior to retrieval? Try
setting a breakpoint, drop out to the command window in Visual Studio
and iterate over the Session.KeyNames collection and see if it's
there. It would be interesting to see if the key got dropped or
possibly overwritten.
Just a few things I can think of right off the top of my head.
Mike
It would seem to me that the easiest way to figure out what's happening is to
run this in debug mode with a breakpoint on your line of code that does the
check and makes the change to the Session variable's value.
You can examine the values and the logic each time your breakpoint is hit.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"aamirghanchi@.gmail.com" wrote:
Quote:
Originally Posted by
Hi, I need to know if anyone else came across this. The Session
variable value I set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to its original value, the one I had set it before in the previous
trip sortcommand event handler.
>
I am trying to implement bidirectional sorting on a datagrid by making
use of session variable Session("SDirection"). In the sortcommand
event handler I check for its value and change it to DESC if its ASC
and vice-versa as follows:
Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
value to be the same that it was before I had made the change.
>
In the web.config the session configuration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
>
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
>
If any one has had the same issue then please share.
>
thanks.
>
>
On Apr 3, 1:08 pm, "Mike Hofer" <kchighl...@.gmail.comwrote:
Quote:
Originally Posted by
On Apr 3, 12:03 pm, aamirghan...@.gmail.com wrote:
>
>
>
>
>
Quote:
Originally Posted by
Hi, I need to know if anyone else came across this. TheSession
variablevalueI set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to itsoriginalvalue, the one I had set it before in the previous
trip sortcommand event handler.
>
Quote:
Originally Posted by
I am trying to implement bidirectional sorting on a datagrid by making
use ofsessionvariableSession("SDirection"). In the sortcommand
event handler I check for itsvalueand change it to DESC if its ASC
and vice-versa as follows:
Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
valueto be the same that it was before I had made the change.
>
Quote:
Originally Posted by
In the web.config thesessionconfiguration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
>
Quote:
Originally Posted by
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
>
Quote:
Originally Posted by
If any one has had the same issue then please share.
>
Quote:
Originally Posted by
thanks.
>
A couple of things I would look at right off the bat:
>
1. Double-check the *case* of the characters in the keys you're using
to reference the items in thesession. I'm not sure if the code sample
above was pasted in, or typed from memory; I know I've run into issues
due to case-sensitivity withsessionkeys. That is,Session("a") !=Session("A").
>
2. Are you checking for the key's existence prior to retrieval? Try
setting a breakpoint, drop out to the command window in Visual Studio
and iterate over theSession.KeyNames collection and see if it's
there. It would be interesting to see if the key got dropped or
possibly overwritten.
>
Just a few things I can think of right off the top of my head.
>
Mike- Hide quoted text -
>
- Show quoted text -
Thanks Mike,
I have replaced all occurrences of Session("SDirection") with
Session("SDirection") throughout the project through IDE so I can be
sure they all are of the same case.
Any way it is the same event handler that sets and then retrieves the
value in the next trip. therefore case sensitivity should not be an
issue.
Also I have looked for the clause "Session("SDirection") =" so that I
can be sure there is no other part of the code in between thats
changing the session value.
I am pretty sure that the key does not get dropped, as it is still
bringing up the old value and not totally nulling it (at least I am
not getting "object reference not set error")
thanks for the feedback again.
On Apr 3, 3:25 pm, aamirghan...@.gmail.com wrote:
Quote:
Originally Posted by
On Apr 3, 1:08 pm, "Mike Hofer" <kchighl...@.gmail.comwrote:
>
>
>
>
>
Quote:
Originally Posted by
On Apr 3, 12:03 pm, aamirghan...@.gmail.com wrote:
>
Quote:
Originally Posted by
Quote:
Originally Posted by
Hi, I need to know if anyone else came across this. TheSession
variablevalueI set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to itsoriginalvalue, the one I had set it before in the previous
trip sortcommand event handler.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
I am trying to implement bidirectional sorting on a datagrid by making
use ofsessionvariableSession("SDirection"). In the sortcommand
event handler I check for itsvalueand change it to DESC if its ASC
and vice-versa as follows:
>Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
>valueto be the same that it was before I had made the change.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
In the web.config thesessionconfiguration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
>
Quote:
Originally Posted by
Quote:
Originally Posted by
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
If any one has had the same issue then please share.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
thanks.
>
Quote:
Originally Posted by
A couple of things I would look at right off the bat:
>
Quote:
Originally Posted by
1. Double-check the *case* of the characters in the keys you're using
to reference the items in thesession. I'm not sure if the code sample
above was pasted in, or typed from memory; I know I've run into issues
due to case-sensitivity withsessionkeys. That is,Session("a") !=Session("A").
>
Quote:
Originally Posted by
2. Are you checking for the key's existence prior to retrieval? Try
setting a breakpoint, drop out to the command window in Visual Studio
and iterate over theSession.KeyNames collection and see if it's
there. It would be interesting to see if the key got dropped or
possibly overwritten.
>
Quote:
Originally Posted by
Just a few things I can think of right off the top of my head.
>
Quote:
Originally Posted by
Mike- Hide quoted text -
>
Quote:
Originally Posted by
- Show quoted text -
>
Thanks Mike,
>
I have replaced all occurrences of Session("SDirection") with
Session("SDirection") throughout the project through IDE so I can be
sure they all are of the same case.
>
Any way it is the same event handler that sets and then retrieves the
value in the next trip. therefore case sensitivity should not be an
issue.
>
Also I have looked for the clause "Session("SDirection") =" so that I
can be sure there is no other part of the code in between thats
changing the session value.
>
I am pretty sure that the key does not get dropped, as it is still
bringing up the old value and not totally nulling it (at least I am
not getting "object reference not set error")
>
thanks for the feedback again.- Hide quoted text -
>
- Show quoted text -
Found the solution:
The dgrid was being sorted twice hence the Sortcommand was being
called twice and I would see the final sorted result. Session variable
SDirection was being set twice first from ASC to DESC and then back
again to ASC. therefore I would not see any change in the sort order.
All this was happening because the sortcommand event handler was
mentioned twice. Once declared in the onSortCommand attribute of the
datagrid in te aspx page and then again by adding "Handles
dgrid.SortCommand" in the definition of the actual event handler in
codefile.
Thanks.
On Apr 3, 3:25 pm, aamirghan...@.gmail.com wrote:
Quote:
Originally Posted by
On Apr 3, 1:08 pm, "Mike Hofer" <kchighl...@.gmail.comwrote:
>
>
>
>
>
Quote:
Originally Posted by
On Apr 3, 12:03 pm, aamirghan...@.gmail.com wrote:
>
Quote:
Originally Posted by
Quote:
Originally Posted by
Hi, I need to know if anyone else came across this. TheSession
variablevalueI set in a sortCommand event handler of a datagrid does
not hold on till the next sortcommand event handler and reverts back
to itsoriginalvalue, the one I had set it before in the previous
trip sortcommand event handler.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
I am trying to implement bidirectional sorting on a datagrid by making
use ofsessionvariableSession("SDirection"). In the sortcommand
event handler I check for itsvalueand change it to DESC if its ASC
and vice-versa as follows:
>Session("SDirection") = IIf(Session("SDirection") = "ASC", "DESC",
"ASC")
For the sake of simplicity I am not checking for the column in the
above code ... just the direction.
It sorts the dgrid fine for that pass, but next time a column (or same
column) header is clicked then in the sortcommand handler I find the
>valueto be the same that it was before I had made the change.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
In the web.config thesessionconfiguration looks like this:
<sessionState mode="InProc" cookieless="AutoDetect" timeout="20"/>
>
Quote:
Originally Posted by
Quote:
Originally Posted by
This app was originally in .Net 1.1 and was working perfectly fine
(and is on the 1.1 framework), but after converting it to 2.0 it has
lost this functionality.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
If any one has had the same issue then please share.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
thanks.
>
Quote:
Originally Posted by
A couple of things I would look at right off the bat:
>
Quote:
Originally Posted by
1. Double-check the *case* of the characters in the keys you're using
to reference the items in thesession. I'm not sure if the code sample
above was pasted in, or typed from memory; I know I've run into issues
due to case-sensitivity withsessionkeys. That is,Session("a") !=Session("A").
>
Quote:
Originally Posted by
2. Are you checking for the key's existence prior to retrieval? Try
setting a breakpoint, drop out to the command window in Visual Studio
and iterate over theSession.KeyNames collection and see if it's
there. It would be interesting to see if the key got dropped or
possibly overwritten.
>
Quote:
Originally Posted by
Just a few things I can think of right off the top of my head.
>
Quote:
Originally Posted by
Mike- Hide quoted text -
>
Quote:
Originally Posted by
- Show quoted text -
>
Thanks Mike,
>
I have replaced all occurrences of Session("SDirection") with
Session("SDirection") throughout the project through IDE so I can be
sure they all are of the same case.
>
Any way it is the same event handler that sets and then retrieves the
value in the next trip. therefore case sensitivity should not be an
issue.
>
Also I have looked for the clause "Session("SDirection") =" so that I
can be sure there is no other part of the code in between thats
changing the session value.
>
I am pretty sure that the key does not get dropped, as it is still
bringing up the old value and not totally nulling it (at least I am
not getting "object reference not set error")
>
thanks for the feedback again.- Hide quoted text -
>
- Show quoted text -
Found the solution:
The dgrid was being sorted twice hence the Sortcommand was being
called twice and I would see the final sorted result. Session
variable
SDirection was being set twice first from ASC to DESC and then back
again to ASC. therefore I would not see any change in the sort order.
All this was happening because the sortcommand event handler was
mentioned twice. Once declared in the onSortCommand attribute of the
datagrid in te aspx page and then again by adding "Handles
dgrid.SortCommand" in the definition of the actual event handler in
codefile.
I checked the 1.1 code which still sorts fine even it had the event
handler mentoned twice. Is this new behavior in 2.0 a bug or by
design?
Thanks.
Tuesday, March 13, 2012
Session Variables across projects
application itself and is written in VB.NET. The second is a web service
written in C#.
The main application launches a window that interacts with the Web Service.
However the session variables in the Web Service are NULL and generate an
exception. I have found no information about utilizing session variables
across projects in the same solution. Is it possible and are there any
caveats?
KentYou can't even use application variables across projects, let alone session
variables. Try a database. Or writing to a shared file.
Dale
"Kent Ogletree" <kent@.nospam.actionic.com> wrote in message
news:e#wW1h3bEHA.3476@.tk2msftngp13.phx.gbl...
> I have a solution the is composed of 2 projects. The first is the main web
> application itself and is written in VB.NET. The second is a web service
> written in C#.
> The main application launches a window that interacts with the Web
Service.
> However the session variables in the Web Service are NULL and generate an
> exception. I have found no information about utilizing session variables
> across projects in the same solution. Is it possible and are there any
> caveats?
> Kent
>
>
Session Variables across projects
application itself and is written in VB.NET. The second is a web service
written in C#.
The main application launches a window that interacts with the Web Service.
However the session variables in the Web Service are NULL and generate an
exception. I have found no information about utilizing session variables
across projects in the same solution. Is it possible and are there any
caveats?
KentYou can't even use application variables across projects, let alone session
variables. Try a database. Or writing to a shared file.
Dale
"Kent Ogletree" <kent@.nospam.actionic.com> wrote in message
news:e#wW1h3bEHA.3476@.tk2msftngp13.phx.gbl...
> I have a solution the is composed of 2 projects. The first is the main web
> application itself and is written in VB.NET. The second is a web service
> written in C#.
> The main application launches a window that interacts with the Web
Service.
> However the session variables in the Web Service are NULL and generate an
> exception. I have found no information about utilizing session variables
> across projects in the same solution. Is it possible and are there any
> caveats?
> Kent