473,387 Members | 1,812 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,387 software developers and data experts.

Session cleared after Redirect

Hi,

I do a Response.Redirect(page), and on the second page I have redirected to,
I get an object out of the session (or at least I attempt to). Just before
the redirect I do:

Session["token"] = tokenizer;

On the redirected page, in PageLoad I do:

Tokenizer tokenizer = (Tokenizer)Session["token"];

But the tokenizer is null, because the session is cleared. This is a
default web application, so I am not sure why it isnt working.

Any advice?

John.
Nov 19 '05 #1
4 1634
Are you sure that tokenizer was not null before you saved it ?

"John" <jr******@hotmail.co.uk> wrote in message
news:eF**************@tk2msftngp13.phx.gbl...
Hi,

I do a Response.Redirect(page), and on the second page I have redirected
to, I get an object out of the session (or at least I attempt to). Just
before the redirect I do:

Session["token"] = tokenizer;

On the redirected page, in PageLoad I do:

Tokenizer tokenizer = (Tokenizer)Session["token"];

But the tokenizer is null, because the session is cleared. This is a
default web application, so I am not sure why it isnt working.

Any advice?

John.

Nov 19 '05 #2
Hi Mr Newbie,

I put the Tokenizer into the session using this:

Tokenizer tokenizer = new Tokenizer();
Session["token"] = tokenizer;

Later on I successfully get the tokenizer back from the session using:

Tokenizer tokenizer = (Tokenizer)Session["token"];

This code exists inside a web control, and all of it works fine. Only when
I access the session on the second page I immediately redirect to, is the
session cleared. I have tried to debug it, and literally on the line of the
redirect, the session contains my value, but doesnt once the new page is
loaded.

Any ideas?

"Mr Newbie" <he**@now.com> wrote in message
news:Oc**************@tk2msftngp13.phx.gbl...
Are you sure that tokenizer was not null before you saved it ?

"John" <jr******@hotmail.co.uk> wrote in message
news:eF**************@tk2msftngp13.phx.gbl...
Hi,

I do a Response.Redirect(page), and on the second page I have redirected
to, I get an object out of the session (or at least I attempt to). Just
before the redirect I do:

Session["token"] = tokenizer;

On the redirected page, in PageLoad I do:

Tokenizer tokenizer = (Tokenizer)Session["token"];

But the tokenizer is null, because the session is cleared. This is a
default web application, so I am not sure why it isnt working.

Any advice?

John.


Nov 19 '05 #3
Sorted it. It seems I have a label on the page, <asp:Label id="MyLabel"
runat="server/"> and the / is inside the server quoted text. The page
doesnt error, but the session is screwed....I think the parser should fail
this.

John.

"Mr Newbie" <he**@now.com> wrote in message
news:Oc**************@tk2msftngp13.phx.gbl...
Are you sure that tokenizer was not null before you saved it ?

"John" <jr******@hotmail.co.uk> wrote in message
news:eF**************@tk2msftngp13.phx.gbl...
Hi,

I do a Response.Redirect(page), and on the second page I have redirected
to, I get an object out of the session (or at least I attempt to). Just
before the redirect I do:

Session["token"] = tokenizer;

On the redirected page, in PageLoad I do:

Tokenizer tokenizer = (Tokenizer)Session["token"];

But the tokenizer is null, because the session is cleared. This is a
default web application, so I am not sure why it isnt working.

Any advice?

John.


Nov 19 '05 #4
yes it should really, well done for finding it anyway

Mr N

"John" <jr******@hotmail.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Sorted it. It seems I have a label on the page, <asp:Label id="MyLabel"
runat="server/"> and the / is inside the server quoted text. The page
doesnt error, but the session is screwed....I think the parser should fail
this.

John.

"Mr Newbie" <he**@now.com> wrote in message
news:Oc**************@tk2msftngp13.phx.gbl...
Are you sure that tokenizer was not null before you saved it ?

"John" <jr******@hotmail.co.uk> wrote in message
news:eF**************@tk2msftngp13.phx.gbl...
Hi,

I do a Response.Redirect(page), and on the second page I have redirected
to, I get an object out of the session (or at least I attempt to). Just
before the redirect I do:

Session["token"] = tokenizer;

On the redirected page, in PageLoad I do:

Tokenizer tokenizer = (Tokenizer)Session["token"];

But the tokenizer is null, because the session is cleared. This is a
default web application, so I am not sure why it isnt working.

Any advice?

John.



Nov 19 '05 #5

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

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
8
by: yabba | last post by:
When IE file/new/window is used a new IE window is opened to the same session as the original. Is there a way to force a new session? TIA
6
by: Nedu N | last post by:
Hi, I am trying to design a Home page for my applicatiion in which i want show the links for for some itms... I tried to put the following <td> <font face="Arial, Helvetica, sans-serif" ...
1
by: Wiktor Zychla | last post by:
Hello there, I've just encountered a strange problem with Session. In one particular scenario it is cleared between pages but the scenario is so specific that I am really, really startled. I've...
4
by: Andy Fish | last post by:
Hi, I have an asp.net application that is using Forms Authentication and maintaining http session state using cookies in the normal way. when the user clicks the logout button I do this: ...
2
by: scott_shuster | last post by:
Hi, I need to preserve state as I'm Response.Redirecting to a page in a subfolder elsewhere in my web. However, everytime I redirect, my session vars are cleared out. Are Session variables...
1
by: pulaki | last post by:
Greetings and thank you! I am passing form data to a distant server that is out of my control. The destination server (posting to) rejects all postings beyond ONE from the same session ID. I...
3
by: Paul | last post by:
I'm having a problem with the session being reset after setting a cookie. This is not supposed to happen. If I comment out the Add line below the site works normally, the session persists. Help. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.