Cross page data: Session, Viewstate or something else?

Z

Zaccariah Kowalsky

Hello,

I have a webapp with on each page a "language" drop down list. Now, if I
choose X, I want to initialise the drop down list to X. Easy to understand.
But what is the best way to do this in ASP.NET? The obvious answer is, I
think, the Session object. But one thing annoys me: a session can expire. It
is difficult to guess the expiration time; 20 minutes, 40, 60? I just don't
know. Is there a better way to pass data between pages? I was thinking about
the good old url parameters: page.aspx?language=en. But I don't think that's
the ASP.NET way.

Ideas, suggestions and comments more than welcome.
 
M

Marina

If you are talking about small amounts of data, passing it in the URL is
fine.

It is not difficult to guess the expiration time of a session, since that is
a setting you configure
 
Z

Zaccariah Kowalsky

Marina said:
If you are talking about small amounts of data, passing it in the URL is
fine.

It is not difficult to guess the expiration time of a session, since that is
a setting you configure

It is. You never know how long a customer will stay on your site. 5 minutes
or 2 hours?
 
A

Adrijan Josic

The session timer is reset each time a user request a
page, so it is perfectly normal to keep your currently
selected language in the session. The session expires if
the user doesn't request a page for longer than X minutes
where X is your session timeout period which is by default
set to 20 minutes.

You could keep the language in the viewstate but it will
not be easily accessible from nested child controls and
such. Since the selected language is more of a global
variable that all pages and controls probably use the
Session is the best way to keep it.
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top