473,378 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 5175
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Peter | last post by:
L.S. I am developing a PHP-login script (on Lycos Tripod) that uses Session to pass on variables. Below is the entire (stripped) structure that I use. It opens a page where you can Set and Read...
1
by: Arthur | last post by:
I have a mix web site, ASP and ASPX files. I have assigned a value to Session("Date") and the href to an ASPX page. When I further href to another ASP Page. The content in Session("Date") becoming...
2
by: +The_Taco+ | last post by:
I already use session variable in my project to set a session timeout when the user doesn't do anything for 10 minutes. When I call other pages, I often use parameters in HREF link. I was...
1
by: John | last post by:
Hi, I have a routine that sets some session variables and then redirects the user to another page in the same application/ same folder. ======= Session("MyName") = "Fredsmith"...
4
by: N. Demos | last post by:
Hello, I'm learning ASP.NET, and am having a strange problem with some example code from the book I'm using. The code increments and displays the value stored in a session variable when the "Add"...
6
by: Vyoma | last post by:
This is quite a bit of problem I am facing, and I cannot point exactly where I am going wrong. I have been lurking around at several forums with regard to login and user authentication scripts and...
25
by: Jonno | last post by:
Hi I am having a problem with session vars being propagated between pages on this site: http://www.meettheancestors.com/sessiontest/index.php If you enter any user id and password and click Log...
3
by: hon123456 | last post by:
Dear all, I have a session variable session("loginid) which can be passed from A.asp to B.asp. Then In B.asp I have a hyperlink to C.asp e.g. < A href..C.asp>. The session variable cannot be...
2
hobbes2006
by: hobbes2006 | last post by:
I am trying to move data from one page to another using $_SESSION, without putting the information on a database. This is what I have. My issue is when I have $_SESSION='john' it passes the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.