ASP href is resetting session variable, why?? HELP

B

Bobby

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?
 
Z

Zifud

Bobby said:
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?
 
B

Bobby

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.asp?action=showorder&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.
 
J

Jeff North

| 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"
 
B

Bobby

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).
 
B

Bobby

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.
 
E

Evertjan.

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.
 
J

Jeff North

| 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.
 
E

Evertjan.

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.asp?action=showorder&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]
 
B

Bobby

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.
 
E

Evertjan.

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.
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Mon, 28
Feb 2005 17:27:45, seen in Evertjan.
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?
 
E

Evertjan.

Dr John Stockton wrote on 28 feb 2005 in comp.lang.javascript:
JRS: In article <[email protected]>, dated Mon,
28 Feb 2005 17:27:45, seen in Evertjan.
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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top