Why so many Session_Start events.

  • Thread starter Thread starter Curious George
  • Start date Start date
C

Curious George

I have a frameset with multiple aspx pages whithin it.

I lauch the page and notice that it triggers many session_start events. In
fact I knotice multiple events for the same page.

I am also using windows authentication.
On a few pages I get guest and then the user who is loged into the computer.

I am writing user information to my session and do not want it writen 8
times.

I can resort to loading my object in the first page but thought that it was
more elegent to do so in the session_start event.

Ideas?

-Scott
 
I attempted to simulate this error and Session_Start only
runs once for me. How do you know that it fires many
session_start events?

JER
 
I use the debuger to step though the program. (Is this a debuger
problem?)

In the debuger window I look at the following vars:
Request.ServerVariables["AUTH_USER"]
Request.ServerVariables["URL"]

I notice that I get guest logons in addition to the user loged in to my box.

I am useing a frameset with multiple .aspx pages.





My code in global.
protected void Session_Start(Object sender, EventArgs e)

{

if (!User.Identity.IsAuthenticated) {

Response.Redirect("hayStupidLogon.aspx");

}

else {

try {

string auth_user =
Request.ServerVariables["AUTH_USER"].Substring(Request.ServerVariables["AUTH
_USER"].IndexOf("\\") + 1);

user loggedInUser = new user(auth_user);

Session["userSettings"] = loggedInUser;

}

catch ( userException ue ) {

//redirect

}

catch ( Exception ex ) {

//redirect

}

}

}



My authentication from web.config

<authentication mode="Windows" />

<!-- AUTHORIZATION

This section sets the authorization policies of the application. You can
allow or deny access

to application resources by user or role. Wildcards: "*" mean everyone, "?"
means anonymous

(unauthenticated) users.

-->

<authorization>

<deny users="?" /> <!-- Allow only athenticated users -->

<!-- <allow users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

<deny users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

-->

</authorization>
 
Is the main frameset an aspx page too? Cause theoretically if the frameset
was an .HTM file then a session wouldnt be started until the frames loaded,
each getting their own session id since the browser had no session cookie to
start the frames with...

The potentially easy fix would be to just rename the frameset to .aspx


--
Eric Newton
C#/ASP Application Developer
(e-mail address removed)-software.com [remove the first "CC."]



Curious George said:
I use the debuger to step though the program. (Is this a debuger
problem?)

In the debuger window I look at the following vars:
Request.ServerVariables["AUTH_USER"]
Request.ServerVariables["URL"]

I notice that I get guest logons in addition to the user loged in to my box.

I am useing a frameset with multiple .aspx pages.





My code in global.
protected void Session_Start(Object sender, EventArgs e)

{

if (!User.Identity.IsAuthenticated) {

Response.Redirect("hayStupidLogon.aspx");

}

else {

try {

string auth_user =
Request.ServerVariables["AUTH_USER"].Substring(Request.ServerVariables["AUTH
_USER"].IndexOf("\\") + 1);

user loggedInUser = new user(auth_user);

Session["userSettings"] = loggedInUser;

}

catch ( userException ue ) {

//redirect

}

catch ( Exception ex ) {

//redirect

}

}

}



My authentication from web.config

<authentication mode="Windows" />

<!-- AUTHORIZATION

This section sets the authorization policies of the application. You can
allow or deny access

to application resources by user or role. Wildcards: "*" mean everyone, "?"
means anonymous

(unauthenticated) users.

-->

<authorization>

<deny users="?" /> <!-- Allow only athenticated users -->

<!-- <allow users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

<deny users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

-->

</authorization>



I attempted to simulate this error and Session_Start only
runs once for me. How do you know that it fires many
session_start events?

JER
 
Thanks for the idea. I had not though of that and will keep it in mind in
the future.

In this case though my first page is default.aspx.

Eric Newton said:
Is the main frameset an aspx page too? Cause theoretically if the frameset
was an .HTM file then a session wouldnt be started until the frames loaded,
each getting their own session id since the browser had no session cookie to
start the frames with...

The potentially easy fix would be to just rename the frameset to .aspx


--
Eric Newton
C#/ASP Application Developer
(e-mail address removed)-software.com [remove the first "CC."]



Curious George said:
I use the debuger to step though the program. (Is this a debuger
problem?)

In the debuger window I look at the following vars:
Request.ServerVariables["AUTH_USER"]
Request.ServerVariables["URL"]

I notice that I get guest logons in addition to the user loged in to my box.

I am useing a frameset with multiple .aspx pages.





My code in global.
protected void Session_Start(Object sender, EventArgs e)

{

if (!User.Identity.IsAuthenticated) {

Response.Redirect("hayStupidLogon.aspx");

}

else {

try {

string auth_user =
Request.ServerVariables["AUTH_USER"].Substring(Request.ServerVariables["AUTH
_USER"].IndexOf("\\") + 1);

user loggedInUser = new user(auth_user);

Session["userSettings"] = loggedInUser;

}

catch ( userException ue ) {

//redirect

}

catch ( Exception ex ) {

//redirect

}

}

}



My authentication from web.config

<authentication mode="Windows" />

<!-- AUTHORIZATION

This section sets the authorization policies of the application. You can
allow or deny access

to application resources by user or role. Wildcards: "*" mean everyone, "?"
means anonymous

(unauthenticated) users.

-->

<authorization>

<deny users="?" /> <!-- Allow only athenticated users -->

<!-- <allow users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

<deny users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

-->

</authorization>



I attempted to simulate this error and Session_Start only
runs once for me. How do you know that it fires many
session_start events?

JER

-----Original Message-----
I have a frameset with multiple aspx pages whithin it.

I lauch the page and notice that it triggers many
session_start events. In
fact I knotice multiple events for the same page.

I am also using windows authentication.
On a few pages I get guest and then the user who is
loged into the computer.

I am writing user information to my session and do not
want it writen 8
times.

I can resort to loading my object in the first page but
thought that it was
more elegent to do so in the session_start event.

Ideas?

-Scott


.
 
Back
Top