Simple Beginner Question (I believe)

P

pvdg42

VS 2003, C# if the language matters.
Scenario:
Two page project, text box content on the start page is loaded into session
variables to be displayed in a greeting on the second page. Works fine the
first trip.
If upon return from the second page to the start page, the user enters new
data into the text boxes and then navigates (code in the navButton_Click
event procedure loads the session variables) to the second page, the old
data is still displayed.
Stepping through in the debugger seems to indicate that new data entry into
the text boxes does not cause the start page to be redrawn, thus the new
data shown in the interface is never transferred to the text property of the
text boxes?

Any thoughts appreciated!
 
K

Kevin Spencer

The start page is not "redrawn," it is created when a PostBack occurs. Are
you re-setting the Session variables prior to doing your redirect?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
P

pvdg42

Kevin Spencer said:
The start page is not "redrawn," it is created when a PostBack occurs. Are
you re-setting the Session variables prior to doing your redirect?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
Yes, I believe so. The code in the click event procedure for the navigate
button is:

Session[ "name" ] = txtName.Text;

Session[ "phonenumber" ] = txtPhoneNumber.Text;

// redirect to RoadTestRegistered.aspx page

Response.Redirect( "RoadTestRegistered.aspx" );

This works fine the first time the user fills in the text boxes and
navigates to the second page. If the user then returns to the first page and
enters new information in the text boxes, the app acts as it the new entries
have been ignored when the navigate button is clicked the second time. The
old (first entries) information reappears on the second page.
 
K

Kevin Spencer

How is the user returning to the first page?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

pvdg42 said:
Kevin Spencer said:
The start page is not "redrawn," it is created when a PostBack occurs.
Are you re-setting the Session variables prior to doing your redirect?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
Yes, I believe so. The code in the click event procedure for the navigate
button is:

Session[ "name" ] = txtName.Text;

Session[ "phonenumber" ] = txtPhoneNumber.Text;

// redirect to RoadTestRegistered.aspx page

Response.Redirect( "RoadTestRegistered.aspx" );

This works fine the first time the user fills in the text boxes and
navigates to the second page. If the user then returns to the first page
and enters new information in the text boxes, the app acts as it the new
entries have been ignored when the navigate button is clicked the second
time. The old (first entries) information reappears on the second page.
 
P

pvdg42

Kevin Spencer said:
How is the user returning to the first page?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull
1. I appreciate you bearing with me :)

2. Via Response.Redirect()
And, I now see that if the browser back button is used instead, the new
values *do* get recognized. Looks like I need a hammer and am trying to use
a screwdriver.
Thanks very much.
 
S

Steven Cheng[MSFT]

Hi Pvdg42,

I agree that the client-side browser's back/forward button is the cause.
When we use back/forward button on client-side browser to navigate page, it
will used the cached item and data in client-side's browser cache, so this
may not works as expected, we can output some http header to prevent
client-side caching, e.g:

#How to prevent caching in Internet Explorer
http://support.microsoft.com/kb/234067/en-us

it provide the example on ASP pages, and ASP.NET also support this (and
provide the Response.Cache property which provide more features on cache
control).

Hope this also helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top