Problems with Session.IsNewSession - Please help...

R

rsouza

Hi.

Recently here in my work we added the following code in the Global.asax
file to handled the session expired and redirect users to the home of
the site explaining them the occurred (some thing like "Your session
has expired, please restart your navigation.").

public void Session_Start(Object sender, EventArgs e) {

if(Session.IsNewSession && Request.Headers["Cookie"] != null &&
Request.Headers["Cookie"].IndexOf("ASP.NET_SessionId") >= 0)
{
Response.Redirect("/index.aspx?timeout=1");
// when the param "timeout" exists in the url the user
receives the message "... Session expired ..."
}
}

In our tests the code above works fine, but now sometimes we open the
browser, type the url address of the site and the message "... session
expired ..." appears. This occurs just in some machines and not all the
times we access the site.

Someone knows what is happening??

Thanks

Rodrigo
 
P

Peter Bradley

I've replied to you in another newsgroup.

Cross posting like this, when the groups concerned are in the same "family"
(e.g. microsoft.public.dotnet ...) may be counter-productive for you. I
understand why people do it, but my experience suggests that it is best to
post to the group that seems most relevant and then only post to another
group if help is not forthcoming.

But it could be just me who's getting old and grumpy.


Peter
 
P

Peter Duniho

(I wonder how many people named "Peter" we can get in this thread :) )

Peter Bromberg said:
Not unless there are two of us getting old and grumpy, and I don't feel
old
at all. But I am sure others share your view, as do I, regarding needless
and
confusing crossposting.

Well, it would help if people would use commonly accepted terminology.

Cross-posting is good (to a point). Multi-posting (which is what the OP
actually did) is bad.

Cross-posting allows a single article to be seen in a variety of newsgroups,
with no additional overhead at any NNTP server, and without causing
individual readers of those newsgroups from having to remark the article as
"read" in each newsgroup.

Multi-posting posts a single article multiple times in a variety of
newsgroups. As far as the NNTP servers and newsreaders are concerned, each
copy of the article is a whole new article and so is treated as such. This
means each copy is stored individually and readers of each newsgroup may
have to mark the same article read multiple times.

Cross-posting gets out of hand when more than two or three newsgroups are
included. At that point, there gets to be way too much cross-talk between
unrelated newsgroups. It's really hard to find a collection of more than
two or three newsgroups where a single topic can truly be "on-topic" in each
and every newsgroup. It can happen, but it's incredibly rare.

In fact, while I always cross-post my questions to this newsgroup to the
microsoft.public.dotnet.framework newsgroup as well, the main reason is that
through common usage of this m.p.d.l.csharp newsgroup, it has become a
defacto "framework" newsgroup as well. Very few of of the questions posted
here are specific to C#. Instead, users use it as a catch-all for any
question that comes up in the course of using C#, even when that question
isn't specific to C#. Most questions here are actually .NET Framework
questions, and so in spite of the name, this newsgroup is equivalent to the
m.p.d.framework newsgroup (and so cross-posting between the two makes
sense).

If this newsgroup actually was just about using C#, then cross-posting
between this newsgroup and the m.p.d.framework newsgroup would rarely be
appropriate as well.

Anyway, I guess my point is really just that I agree that the OP
multi-posting wasn't a good idea, but that cross-posting is actually quite
appropriate in many cases.

Pete
 

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

Top