469,366 Members | 2,254 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

ASP href is resetting session variable, why?? HELP

I have this line, at this time the value of Session("Login") is 1:

Response.Write "<a href=" & Request("script_name") & _
"?action=show&o=" & rsCustOrders("OrderID") & _
">" & rsCustOrders("OrderID") & "</a>"

Once you click on it, it refreshes the page and goes to the following
section, and somehow the value of Session("Login") is 0, hence, it ends
up in the ELSE trap:

If Session("Login") = 1 Then
If Trim(Request("o")) <> "" Then
Session("OrderID") = Request("o")
Response.Buffer = True
Response.Clear
Response.Redirect Request("script_name") & _
"?action=viewinfo&ordnum=" & Session("OrderID")
End If
Else
... blah blah
End If

Can someone tell me why Session("Login") is rest to 0? Initial value
in global.asa for this is set to 0. I can't figure it out why it would
reset it.
However, if I DO NOT use "<a href", it does not reset this?

Jul 23 '05 #1
14 4937
Bobby wrote:
I have this line, at this time the value of Session("Login") is 1:

Response.Write "<a href=" & Request("script_name") & _
"?action=show&o=" & rsCustOrders("OrderID") & _
">" & rsCustOrders("OrderID") & "</a>"

Once you click on it, it refreshes the page and goes to the following
section, and somehow the value of Session("Login") is 0, hence, it ends
up in the ELSE trap:

If Session("Login") = 1 Then
If Trim(Request("o")) <> "" Then
Session("OrderID") = Request("o")
Response.Buffer = True
Response.Clear
Response.Redirect Request("script_name") & _
"?action=viewinfo&ordnum=" & Session("OrderID")
End If
Else
... blah blah
End If

Can someone tell me why Session("Login") is rest to 0? Initial value
in global.asa for this is set to 0. I can't figure it out why it would
reset it.
However, if I DO NOT use "<a href", it does not reset this?


I think you have the wrong newsgroup. This place is for
JavaScript, not ASP.

If your issue is with the JavaScript generated by your ASP page,
then post whatever is received by the client, not the ASP code
that generates it. In other words, what does:

<a href=" & Request("script_name") & _
"?action=show&o=" & rsCustOrders("OrderID") & _
">" & rsCustOrders("OrderID") & "</a>

actually look like at the client?

--
Zif
Jul 23 '05 #2
Yes, I know this i JS newsgroup, I didn't know which ASP group to post.
When you bring the mouse over to the OrderID, it looks like this:
http://www.mytestserver.com/vueorder...der&ordnum=146.
When you click on the hyperlink, it then goes into the ELSE trap 'cause
session variable now is set to 0. How I know my session variable
values, I added an include file, that cycles through the session
variable collection.

Jul 23 '05 #3
Bobby wrote:
Yes, I know this i JS newsgroup, I didn't know which ASP group to post.
Hmm. Anything microsoft.public is kinda antsy, but

microsoft.public.inetserver.asp.general

may suit.
When you bring the mouse over to the OrderID, it looks like this:
http://www.mytestserver.com/vueorder...der&ordnum=146.

[...]

Clicking on your link just gives a 404 message...

--
Zif
Jul 23 '05 #4
On 23 Feb 2005 20:31:40 -0800, in comp.lang.javascript "Bobby"
<bi*****@gmail.com> wrote:
| I have this line, at this time the value of Session("Login") is 1:
|
| Response.Write "<a href=" & Request("script_name") & _
| "?action=show&o=" & rsCustOrders("OrderID") & _
| ">" & rsCustOrders("OrderID") & "</a>"
|
| Once you click on it, it refreshes the page and goes to the following
| section, and somehow the value of Session("Login") is 0, hence, it ends
| up in the ELSE trap:
|
| If Session("Login") = 1 Then
| If Trim(Request("o")) <> "" Then
| Session("OrderID") = Request("o")
| Response.Buffer = True
| Response.Clear
| Response.Redirect Request("script_name") & _
| "?action=viewinfo&ordnum=" & Session("OrderID")
| End If
| Else
| ... blah blah
| End If
|
| Can someone tell me why Session("Login") is rest to 0? Initial value
| in global.asa for this is set to 0. I can't figure it out why it would
| reset it.
| However, if I DO NOT use "<a href", it does not reset this?


How have you set your session variable?
Session("Login") = 1
or
Session("Login") = "1"
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #5
First, don't click on the hyperlink, 'cause that mytestserver.com is
still not on public, only internal, hence error 404.

I have been reading more on this. And have found where the problem
lies, but still no solution yet. -- >> The problem lies with the state
of my session.

Although on my website, I have created session variables, some through
global.asa and others on the fly. And I have been able to maintain my
state, even when I had
Response.Clear
Response.Redirect
statements. And it will maintain state. However, the problem lies
when you do <A HREF, then immediately I loose state.

The reason Session("Login") would go back to 0 (zero), was because my
onStart section in global.asa starts of with zero, anytime a new
session is started. Which explained, that when I dd not have
Session("Login") in global.asa, upon executing <A HREF, my session
variable would simply disappear, hence, telling me that my state is
lost.

Now, I need to find out, how can I maintain this state under <A HREF.
(I have been reading more on cookies, and header info, there could be
some sort of an answer there, but havent don't figured that out yet).

Jul 23 '05 #6
Well, since I have figured out the solution, I wanted to share that
with everyone.

An <a href tag in asp will loose session even though it is not using
Frameset, as outlined my Microsoft knowledgebase, it affect those who'd
use <a href tag.

The approach to fix this is to create a cookie without expiration,
hence it will remain in memory.

Jul 23 '05 #7
Bobby wrote on 25 feb 2005 in comp.lang.javascript:
Well, since I have figured out the solution, I wanted to share that
with everyone.

An <a href tag in asp will loose session even though it is not using
Frameset, as outlined my Microsoft knowledgebase, it affect those who'd
use <a href tag.
what nonsense, the session stays for me.

The approach to fix this is to create a cookie without expiration,
hence it will remain in memory.


Same as above. You cannot fix, what not is broken.

You cannot fix a lost session with a cookie.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #8
On 25 Feb 2005 07:55:39 -0800, in comp.lang.javascript "Bobby"
<bi*****@gmail.com> wrote:
| Well, since I have figured out the solution, I wanted to share that
| with everyone.
|
| An <a href tag in asp will loose session even though it is not using
| Frameset, as outlined my Microsoft knowledgebase, it affect those who'd
| use <a href tag.
Can you give the url of the article?
An anchor tag shouldn't upset session variables.
| The approach to fix this is to create a cookie without expiration,
| hence it will remain in memory.


---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #9
Try using a relative hyperlink rather than an absolute one
(/vueorder.asp?action=showorder&ordnum=146 rather than
http://www.mytestserver.com/vueorder...er&ordnum=146).

I think you will find that fixes the problem. it is not a problem with
href's it is just that absolute hyperlinks create a new session with
iis.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #10
Mike D wrote on 26 feb 2005 in comp.lang.javascript:
Try using a relative hyperlink rather than an absolute one
(/vueorder.asp?action=showorder&ordnum=146 rather than
http://www.mytestserver.com/vueorder...er&ordnum=146).
This is not email, but usenet.
Without quoting where you are answering on, your answer is useless for
most.
I think you will find that fixes the problem. it is not a problem with
href's it is just that absolute hyperlinks create a new session with
iis.


Not true. The request to the server doesn't even differ.

[Only if the specified domain differs, but that is another story]

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #11
Mike D., I will try that using Relative instead of Absolute.

Evertjan, I posted after doing quite a bit of searches on this problem
on the Internet on this issue. You will find I'm not the only one with
this problem.

Yes, as much bizzare this problem sees, and I'm not too happy using
cookies either, but it helped resolved the question.

Now, if using the relative solves this problem, I will remove using
cookies.

And BTW, some of my other pages use <a href, and session stays, but
perhaps it could the fact I'm using query strings, I don't know. So
I'm not 100% why it would happen.

Jul 23 '05 #12
Bobby wrote on 28 feb 2005 in comp.lang.javascript:
Mike D., I will try that using Relative instead of Absolute.

Evertjan, I posted after doing quite a bit of searches on this problem
on the Internet on this issue. You will find I'm not the only one with
this problem.


Dear mike,

This is not email but usenet.

If you don't post relevant part of the posting you are replying on, as is
according to usenet netiquette, we [in general] are obliged to search for
it and the posting will not always be available on all news servers.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #13
JRS: In article <Xn********************@194.109.133.29>, dated Mon, 28
Feb 2005 17:27:45, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :

If you don't post relevant part of the posting you are replying on, as is
according to usenet netiquette, we [in general] are obliged to search for
it and the posting will not always be available on all news servers.


He's using Google. You need, IMHO, to explain how to get it right; and,
IMHO, so does the FAQ.

Has the Google indentation problem been solved?

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Jul 23 '05 #14
Dr John Stockton wrote on 28 feb 2005 in comp.lang.javascript:
JRS: In article <Xn********************@194.109.133.29>, dated Mon,
28 Feb 2005 17:27:45, seen in news:comp.lang.javascript, Evertjan.
<ex**************@interxnl.net> posted :

If you don't post relevant part of the posting you are replying on, as
is according to usenet netiquette, we [in general] are obliged to
search for it and the posting will not always be available on all news
servers.
He's using Google. You need, IMHO, to explain how to get it right;
and, IMHO, so does the FAQ.


If so, he should condform to netiquette and read the faq,
and so should Google.

Has the Google indentation problem been solved?


Google has an indentity crisis ?
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Peter | last post: by
2 posts views Thread by +The_Taco+ | last post: by
25 posts views Thread by Jonno | last post: by
3 posts views Thread by hon123456 | last post: by
hobbes2006
2 posts views Thread by hobbes2006 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.