Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > ASP href is resetting session variable, why?? HELP

Reply
Thread Tools

ASP href is resetting session variable, why?? HELP

 
 
Bobby
Guest
Posts: n/a
 
      02-24-2005
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?

 
Reply With Quote
 
 
 
 
Zifud
Guest
Posts: n/a
 
      02-24-2005
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
 
Reply With Quote
 
 
 
 
Bobby
Guest
Posts: n/a
 
      02-24-2005
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.

 
Reply With Quote
 
Zifud
Guest
Posts: n/a
 
      02-24-2005
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
 
Reply With Quote
 
Jeff North
Guest
Posts: n/a
 
      02-24-2005
On 23 Feb 2005 20:31:40 -0800, in comp.lang.javascript "Bobby"
<(E-Mail Removed)> 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"
---------------------------------------------------------------
http://www.velocityreviews.com/forums/(E-Mail Removed) : Remove your pants to reply
---------------------------------------------------------------
 
Reply With Quote
 
Bobby
Guest
Posts: n/a
 
      02-24-2005
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).

 
Reply With Quote
 
Bobby
Guest
Posts: n/a
 
      02-25-2005
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.

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      02-25-2005
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)

 
Reply With Quote
 
Jeff North
Guest
Posts: n/a
 
      02-26-2005
On 25 Feb 2005 07:55:39 -0800, in comp.lang.javascript "Bobby"
<(E-Mail Removed)> 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.


---------------------------------------------------------------
(E-Mail Removed) : Remove your pants to reply
---------------------------------------------------------------
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      02-26-2005
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...der&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)

 
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
BASE HREF and A HREF="#" onclick="..." Vincent van Beveren Javascript 2 07-06-2006 08:33 AM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
onClick method question (this.href and document.location.href) yogesh.bhardwaj@gmail.com Javascript 2 02-03-2005 02:38 PM
difference between location.href and window.location.href? saiho.yuen Javascript 3 09-14-2004 06:51 PM
Problem: Setting MSIE iframe innerHTML change relative href/src to absolute href/src Soren Vejrum Javascript 4 07-05-2003 01:47 PM



Advertisments