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

Problems with Session.IsNewSession - Please help...

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

Dec 14 '06 #1
3 6253
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

"rsouza" <ro********@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
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

Dec 14 '06 #2
(I wonder how many people named "Peter" we can get in this thread :) )

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:74**********************************@microsof t.com...
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
Dec 14 '06 #3
Yes. Thanks for that. I'd never seen that defined before.
Peter

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:4F**********************************@microsof t.com...
That was a good point on the semantics, Peter.
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


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

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in
message
news:74**********************************@microso ft.com...
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

Dec 15 '06 #4

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

Similar topics

5
by: Mark Rodrigues | last post by:
Hi Everyone, I have been fighting a problem for a while and I wonder if someone out there can help. This problem has been presented in a number of news postings previously but I am yet to see a...
2
by: Dinkster | last post by:
BackGround: - We are new to ASP - We thought we would experiment with using the session object (in proc) to store a small amount of data. - We get different results when cookieless is set to...
2
by: David Popeck | last post by:
I have an ASP.NET application that is using forms authentication and I want to know when a session has timed out I have read quite a lot of posts here about this but no-one seems to have to same...
2
by: Ricky K. Rasmussen | last post by:
Hi NG, We have a rather large ASP.NET application that uses popups to display various dialogs to the user. In our work we've come over a rather annoying "bug": If we open a modal dialog using...
13
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i...
4
by: Mark Rae | last post by:
Hi, I have a site which uses dynamic MasterPages. The selection of the MasterPage to use is determined by an encrypted QueryString. Session_Start looks for the presence of the QueryString,...
0
by: rsouza | last post by:
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...
2
by: rsouza | last post by:
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...
4
by: Zhangming Su | last post by:
Hi, Can any one tell me why Session.IsNewSession doesn't work with Firwfox broswer? Z. Su
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.