473,839 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with Session.IsNewSe ssion - 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(O bject sender, EventArgs e) {

if(Session.IsNe wSession && Request.Headers["Cookie"] != null &&
Request.Headers["Cookie"].IndexOf("ASP.N ET_SessionId") >= 0)
{
Response.Redire ct("/index.aspx?time out=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 6290
I've replied to you in another newsgroup.

Cross posting like this, when the groups concerned are in the same "family"
(e.g. microsoft.publi c.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********@gma il.comwrote in message
news:11******** **************@ j72g2000cwa.goo glegroups.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(O bject sender, EventArgs e) {

if(Session.IsNe wSession && Request.Headers["Cookie"] != null &&
Request.Headers["Cookie"].IndexOf("ASP.N ET_SessionId") >= 0)
{
Response.Redire ct("/index.aspx?time out=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*******@yaho o.nospammin.com wrote in message
news:74******** *************** ***********@mic rosoft.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.publi c.dotnet.framew ork 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*******@yaho o.nospammin.com wrote in message
news:4F******** *************** ***********@mic rosoft.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*******@yaho o.nospammin.com wrote in
message
news:74******* *************** ************@mi crosoft.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.publ ic.dotnet.frame work 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.framewor k 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
2617
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 response with a suitable resolution. So here goes ... We have a web site which stores an instance of a class into a Session, which is used in a number of pages. The code looks something like:
2
1871
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 "true" veses "false". - Our simple test app involved updating a counter that was stored as an item in the Session Object. We allow resetting the counter to zero, and adding or subtracting one from the counter. - We were trying to determine when a "NEW...
2
5338
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 issue Rather than telling the user that a timeout has occured I want to know on the server so I can call a stored procedure Adding code to Session_End in global.asax doesn't help because this only gets called when Session.Destroy is called and not...
2
4941
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 the javascript command window.showModalDialog() we loose the current Session if a new window is opend from within the modal one (using the window.open() method). The "funny" thing is that this only occurs if another instance of IE has been
13
2878
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 visit again .... null ... again .... it works ..... again ... it works ... again ..... null....... and so on and on .... it does randomly work or not.... what is this effect?
4
3553
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, decrypts it, and sets up a Session variable holding the name of the MasterPage to use. The contents pages interrogate this Session variable in the Page_PreInit method (has to be done here) and apply the correct MasterPage accordingly. Works...
0
990
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 thing like "Your session has expired, please restart your navigation."). public void Session_Start(Object sender, EventArgs e) { if(Session.IsNewSession && Request.Headers != null &&
2
2752
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 thing like "Your session has expired, please restart your navigation."). public void Session_Start(Object sender, EventArgs e) { if(Session.IsNewSession && Request.Headers != null &&
4
2144
by: Zhangming Su | last post by:
Hi, Can any one tell me why Session.IsNewSession doesn't work with Firwfox broswer? Z. Su
0
9855
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10908
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10586
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10648
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7017
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5866
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.