Groups | Blog | Home
all groups > asp.net > april 2005 >

asp.net : IHttpHandler, ProcessRequest and Session


Chance Hopkins
4/13/2005 11:05:15 PM
I've got the IRequiresSessionState interface implemented, but because of
forms authentication my page fires twice and causes certain session
functions to update twice which messes up my values.

Is there anyway to keep ProcessRequest from firing twice, or detect if it
has fired once and not call certain functions in the page again on the
second time through?

Teemu Keiski
4/14/2005 12:00:00 AM
Hi,

[quoted text, click to view]

What do you mean with this? Can you elaborate a bit? Do you have some custom
authentication in use with Forms authentication (or just that page gts
executed twice for a good reason?).

--
Teemu Keiski
ASP.NET MVP, Finland


Chance Hopkins
4/14/2005 1:33:44 AM

[quoted text, click to view]

I was refering to this thread:

http://tinyurl.com/66lm8

I'm experiencing the same thing. I make a handler and create a page that is
made in csharp.
All events in the page class fire twice, and I'm assuming that is due to the
comment in the link above.
Everything else works fine, that page displays, events that I wire up in
controls fire and all is great.

Except session variables end up getting set twice. So:

Session("item1") = Session("item1") + somevalue

ends up happending twice and I get

Session("item1") = Session("item1") + somevalue + somevalue

I wondering if anyone else might have a convenient "global" work around for
this. I've run into a wall, as I've been working on it for three days now.

[quoted text, click to view]

Chance Hopkins
4/14/2005 3:22:47 AM

[quoted text, click to view]

Good thinking, but it looks like it returns true both times.

I also just tried setting this in web.config

<pages autoEventWireup="false" />

as discribed in this article:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;317690

I heard that fired events twice sometimes, although I'm working in csharp.

I may end up having to figure out a different way to pass this value around.
It would be nice to be able to figure out a work around though, for the
future.

[quoted text, click to view]

Teemu Keiski
4/14/2005 9:42:11 AM
Hmm...can you try getting past it with checking Request.IsAuthenticated (or
does it return Ture in your case for the very first request)?

--
Teemu Keiski
ASP.NET MVP, Finland


[quoted text, click to view]

AddThis Social Bookmark Button