473,699 Members | 2,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("O rderID") & _
">" & rsCustOrders("O rderID") & "</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("OrderI D") = Request("o")
Response.Buffer = True
Response.Clear
Response.Redire ct Request("script _name") & _
"?action=viewin fo&ordnum=" & Session("OrderI D")
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 5197
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("O rderID") & _
">" & rsCustOrders("O rderID") & "</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("OrderI D") = Request("o")
Response.Buffer = True
Response.Clear
Response.Redire ct Request("script _name") & _
"?action=viewin fo&ordnum=" & Session("OrderI D")
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("O rderID") & _
">" & rsCustOrders("O rderID") & "</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.publi c is kinda antsy, but

microsoft.publi c.inetserver.as p.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.javas cript "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("O rderID") & _
| ">" & rsCustOrders("O rderID") & "</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("OrderI D") = Request("o")
| Response.Buffer = True
| Response.Clear
| Response.Redire ct Request("script _name") & _
| "?action=viewin fo&ordnum=" & Session("OrderI D")
| 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******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #5
First, don't click on the hyperlink, 'cause that mytestserver.co m 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.Redire ct
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.javas cript:
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.javas cript "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******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #9
Try using a relative hyperlink rather than an absolute one
(/vueorder.asp?ac tion=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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6475
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 the session variable BUT ... It doesn't work!!! It seems that both set- and readlink open their own private session. How can I get the read-link to access the proper session variable?
1
4392
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 blank. Is it in design? Or bug? Is there any work around solution? Also, Is there any way to secure my ASPX source code from client? I don't want clients to be able to see the source code but they can run the ASPX.
2
2491
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 wondering if it was better to pass parameter from page to page as session variable instead of doing it in HREF link? Thx for the hint !
1
3210
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" Response.Redirect("./AnewPage.aspx") ======= If I go, Response.Write(Session("MyName")) in the new page the session variable does not exist.
4
2518
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" button is clicked. In addition, the session variable is reset to zero when the "Empty" button is pressed. The problem is if the value is non-zero and the page is reloaded the value is incremented. It appears as if the "Add" onClick event...
6
8353
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 I have got as far as this: - Starting a session - Registering a session variable - Using the variable to check if the user is authenticated or not. - Authenticating the user through MySQL database - Logging of the user, by setting the...
25
2436
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 In (no actual validation is performed), and then move around the other pages and/or keep refreshing the pages it will eventually display something that is incorrect i.e. saying your logged in when you aren't or vice versa. The exact same code...
3
4761
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 passed to C.asp. The session variable is empty. What can I do to debug this problem? Thanks
2
1209
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 $_SESSION to the next page but when I have the $_POST in it will not pass the information that is put in the input. Why is it doing this? Also my register_globals is turned to off. Thanks in advance. <?php session_start(); $_SESSION = $_POST; ?>
0
8705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8896
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7784
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.