By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,569 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,569 IT Pros & Developers. It's quick & easy.

Passing information between pages C# and ASP

P: n/a
Im using C# in a web app. Ive got a page with a linkbutton with the
following code for the click event:

-----------------
Session["FirstTime"] = "Test";
Server.Transfer("TestPage.aspx");
-----------------

In the testpage Page_Load section I have the following:
------------------
string SessionTest = Request.QueryString["FirstTime"];
------------------

In debug mode the session state holds nothing. Please could someone show me
how to correctly store information in the session state that can be
retrieved from another page.

Greatly appreciated,
Thanks,
Grant
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You are assigning a value to a session variable - but then trying to get the
value of that variable from the query string? Huh? Those 2 are not related
in any way.

And you can't read a session variable set in ASP.NET in ASP or vice versa.

"Grant" <gp*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Im using C# in a web app. Ive got a page with a linkbutton with the
following code for the click event:

-----------------
Session["FirstTime"] = "Test";
Server.Transfer("TestPage.aspx");
-----------------

In the testpage Page_Load section I have the following:
------------------
string SessionTest = Request.QueryString["FirstTime"];
------------------

In debug mode the session state holds nothing. Please could someone show
me how to correctly store information in the session state that can be
retrieved from another page.

Greatly appreciated,
Thanks,
Grant

Nov 17 '05 #2

P: n/a
<snip />

// Source Page
Session["IMLazy"] = "Too Lazy To Search & Lookup Simple Stuff";

// Target Page
string imLazy;
imLazy = Session["IMLazy"].ToString();
Response.Write(imLazy);

// Returns
Too Lazy To Search & Lookup Simple Stuff

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
Nov 17 '05 #3

P: n/a
Marina - that example came from MSDN, do you know how to do it or not your
response was no help at all. Ive been using Properties and the
Context.Handler to get parameters between pages.

Thanks for your answer Clinton. I posted it here because im on dial up and
web access is dog slow - so not lazy, just trying to keep web frustration
levels to a minimum.

Boyit'scoldinhere!

"Grant" <gp*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Im using C# in a web app. Ive got a page with a linkbutton with the
following code for the click event:

-----------------
Session["FirstTime"] = "Test";
Server.Transfer("TestPage.aspx");
-----------------

In the testpage Page_Load section I have the following:
------------------
string SessionTest = Request.QueryString["FirstTime"];
------------------

In debug mode the session state holds nothing. Please could someone show
me how to correctly store information in the session state that can be
retrieved from another page.

Greatly appreciated,
Thanks,
Grant

Nov 17 '05 #4

P: n/a
Excuses. Excuses but good to see you can take a joke.

Now beg, borrow or steal a copy of asp.netPro, October 2005 which I think
should still be on the shelves.
The cover has a "Keep Out Armed Gaurd on Duty."

Steve Orr has written a masterpiece...
"Passing Values - How Do I Pass Values between Pages, Controls and other
Objects?"
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


"Grant" <gp*****@hotmail.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
Marina - that example came from MSDN, do you know how to do it or not your
response was no help at all. Ive been using Properties and the
Context.Handler to get parameters between pages.

Thanks for your answer Clinton. I posted it here because im on dial up and
web access is dog slow - so not lazy, just trying to keep web frustration
levels to a minimum.

Boyit'scoldinhere!

"Grant" <gp*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Im using C# in a web app. Ive got a page with a linkbutton with the
following code for the click event:

-----------------
Session["FirstTime"] = "Test";
Server.Transfer("TestPage.aspx");
-----------------

In the testpage Page_Load section I have the following:
------------------
string SessionTest = Request.QueryString["FirstTime"];
------------------

In debug mode the session state holds nothing. Please could someone show
me how to correctly store information in the session state that can be
retrieved from another page.

Greatly appreciated,
Thanks,
Grant


Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.