Showing posts with label browser. Show all posts
Showing posts with label browser. Show all posts

Saturday, March 31, 2012

Session Timeout using frames

Hello,

My main ASP.NET interface uses frames. The problem is that once the session
times out (if the user hasn't yet closed the browser), the user is
automatically redirected to the login screen (setup in Web.Config file), but
this occurs for every frame!!! Is there a way to redirect away from the main
interface completely?

Thanks!your frame page is html or aspx?
if it is html try to rename in aspx!

"Bilbo" <Bilbo@.cox.net> wrote in message
news:OSWo03XVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Hello,
> My main ASP.NET interface uses frames. The problem is that once the
session
> times out (if the user hasn't yet closed the browser), the user is
> automatically redirected to the login screen (setup in Web.Config file),
but
> this occurs for every frame!!! Is there a way to redirect away from the
main
> interface completely?
> Thanks!
Its kinda irritating but I found a solution for it.
Use this javascript so the login page will "bust out of frame".

<script>
if (parent.frames.length > 0) {
parent.location.href = self.document.location
}
</script
This script make sure that the page will bust out of frame, so you only have
one login page.

Richard

"Bilbo" <Bilbo@.cox.net> schreef in bericht
news:OSWo03XVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Hello,
> My main ASP.NET interface uses frames. The problem is that once the
session
> times out (if the user hasn't yet closed the browser), the user is
> automatically redirected to the login screen (setup in Web.Config file),
but
> this occurs for every frame!!! Is there a way to redirect away from the
main
> interface completely?
> Thanks!
In the Login Page add this Client Side Code so that you can "Break Away
From Frames"

<Script Language="JavaScript">
if (top != self) {top.location.href = self.location.href;}
</Script --
Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Session Timeout using frames

Hello,
My main ASP.NET interface uses frames. The problem is that once the session
times out (if the user hasn't yet closed the browser), the user is
automatically redirected to the login screen (setup in Web.Config file), but
this occurs for every frame!!! Is there a way to redirect away from the main
interface completely?
Thanks!your frame page is html or aspx?
if it is html try to rename in aspx!
"Bilbo" <Bilbo@.cox.net> wrote in message
news:OSWo03XVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Hello,
> My main ASP.NET interface uses frames. The problem is that once the
session
> times out (if the user hasn't yet closed the browser), the user is
> automatically redirected to the login screen (setup in Web.Config file),
but
> this occurs for every frame!!! Is there a way to redirect away from the
main
> interface completely?
> Thanks!
>
In the Login Page add this Client Side Code so that you can "Break Away
From Frames"
<Script Language="JavaScript">
if (top != self) {top.location.href = self.location.href;}
</Script -->
Trevor Benedict R
MCSD
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Its kinda irritating but I found a solution for it.
Use this javascript so the login page will "bust out of frame".
<script>
if (parent.frames.length > 0) {
parent.location.href = self.document.location
}
</script>
This script make sure that the page will bust out of frame, so you only have
one login page.
Richard
"Bilbo" <Bilbo@.cox.net> schreef in bericht
news:OSWo03XVEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Hello,
> My main ASP.NET interface uses frames. The problem is that once the
session
> times out (if the user hasn't yet closed the browser), the user is
> automatically redirected to the login screen (setup in Web.Config file),
but
> this occurs for every frame!!! Is there a way to redirect away from the
main
> interface completely?
> Thanks!
>

Session timeouts

Hi
I've just been told that closing your browser closes your session on the
web-site you are viewing, is this true? If so, is this the browser that init
iates
the closure, or the server?
Thanks
Kev"Mantorok" <spamthis@.spam.com> wrote in message
news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk...

> I've just been told that closing your browser closes your session on the
> web-site you are viewing, is this true?
Totally untrue. If you want to make sure that a session is closed, you need
to provide a mechanism for a user to initiate it i.e. some sort of "Log out"
facility which tears down the session. The server is simply waiting to
respond to requests from clients - it cannot know when a browser has been
closed.
Do a Google search - this topic has been discussed ad nauseum...
http://www.thescripts.com/forum/thread321607.html
"Mark Rae" <mark@.markN-O-S-P-A-M.co.uk> wrote in message
news:OjkCr%23AdGHA.4276@.TK2MSFTNGP03.phx.gbl...
> "Mantorok" <spamthis@.spam.com> wrote in message
> news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk...
>
> Totally untrue. If you want to make sure that a session is closed, you
> need to provide a mechanism for a user to initiate it i.e. some sort of
> "Log out" facility which tears down the session. The server is simply
> waiting to respond to requests from clients - it cannot know when a
> browser has been closed.
Thank you for clarifying my thoughts, when I first heard it I immediately
said "How does the server know the client closed the browser?", silenced
followed.....
Cheers
Kev
"Mark Rae" <mark@.markN-O-S-P-A-M.co.uk> wrote in message
news:OjkCr%23AdGHA.4276@.TK2MSFTNGP03.phx.gbl...
> "Mantorok" <spamthis@.spam.com> wrote in message
> news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk...
>
> Totally untrue. If you want to make sure that a session is closed, you
> need to provide a mechanism for a user to initiate it i.e. some sort of
> "Log out" facility which tears down the session. The server is simply
> waiting to respond to requests from clients - it cannot know when a
> browser has been closed.
Come to think of it - when I log in to my (internal) web-site it stores my
login in a session variable, however when I close the browser and re-open my
login session has gone.
What's happening here?
Thanks
Kev
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e3sbfk$6br$1@.newsfeed.th.ifl.net...

> Come to think of it - when I log in to my (internal) web-site it stores my
> login in a session variable, however when I close the browser and re-open
> my login session has gone.
> What's happening here?
Opening the browser again causes a new session to be created.
"Mark Rae" <mark@.markN-O-S-P-A-M.co.uk> wrote in message
news:Oy$AtTBdGHA.4912@.TK2MSFTNGP05.phx.gbl...
> "Mantorok" <mantorok@.mantorok.com> wrote in message
> news:e3sbfk$6br$1@.newsfeed.th.ifl.net...
>
> Opening the browser again causes a new session to be created.
Aha, thanks.
Kev
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e3scup$71j$1@.newsfeed.th.ifl.net...

> Aha, thanks.
http://www.google.com/search?source...22+IsNewSession
Covering a few items in this thread:
Closing your browser does nothing on the server. The server still waits
until timeout to get rid of the session. And, opening a browser creates a
new session. This means you now have two sessions, but you are only
connected to the newest session.
The way this works is through a session cookie, or server cookie. Even users
with normal cookies off can get these. There are some older browsers that
see both types of cookies as the same. And, yes, an industrious user can
refuse server cookies, as well. But it is rare.
When you open the browser, it will not reuse a server cookie, even if the
session has not timed out. This is for security purposes. So, it creates a
new connection and gets a new server cookie (session). If you open and close
the browser 100 times, you have 100 sessions until they time out, but you
cannot get to any for which you have closed the browser.
Another interesting topic. If you open a new browser instance using Control
+ N, both connect to the same session. If you use the menu, you have two
different sessions. Cool, eh?
Remember, the web is stateless, so it has no clue what the user is doing.
Gregory A. Beamer
****************************************
*********
Think Outside the Box!
****************************************
*********
"Mantorok" <spamthis@.spam.com> wrote in message
news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk...
> Hi
> I've just been told that closing your browser closes your session on the
> web-site you are viewing, is this true? If so, is this the browser that
> initiates the closure, or the server?
> Thanks
> Kev
>
Cowboy,
Very good.
How? an industrious user can
refuse server cookies, as well. But it is rare.
more details please thanks for the education
SA
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
message news:eeghAWCdGHA.5048@.TK2MSFTNGP04.phx.gbl...
> Covering a few items in this thread:
> Closing your browser does nothing on the server. The server still waits
> until timeout to get rid of the session. And, opening a browser creates a
> new session. This means you now have two sessions, but you are only
> connected to the newest session.
> The way this works is through a session cookie, or server cookie. Even
> users with normal cookies off can get these. There are some older browsers
> that see both types of cookies as the same. And, yes, an industrious user
> can refuse server cookies, as well. But it is rare.
> When you open the browser, it will not reuse a server cookie, even if the
> session has not timed out. This is for security purposes. So, it creates a
> new connection and gets a new server cookie (session). If you open and
> close the browser 100 times, you have 100 sessions until they time out,
> but you cannot get to any for which you have closed the browser.
> Another interesting topic. If you open a new browser instance using
> Control + N, both connect to the same session. If you use the menu, you
> have two different sessions. Cool, eh?
> Remember, the web is stateless, so it has no clue what the user is doing.
> --
> Gregory A. Beamer
> ****************************************
*********
> Think Outside the Box!
> ****************************************
*********
> "Mantorok" <spamthis@.spam.com> wrote in message
> news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk...
>

Session timeouts

Hi

I've just been told that closing your browser closes your session on the
web-site you are viewing, is this true? If so, is this the browser that initiates
the closure, or the server?

Thanks
Kev"Mantorok" <spamthis@.spam.com> wrote in message
news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk ...

> I've just been told that closing your browser closes your session on the
> web-site you are viewing, is this true?

Totally untrue. If you want to make sure that a session is closed, you need
to provide a mechanism for a user to initiate it i.e. some sort of "Log out"
facility which tears down the session. The server is simply waiting to
respond to requests from clients - it cannot know when a browser has been
closed.

Do a Google search - this topic has been discussed ad nauseum...
http://www.msdner.com/forum/thread321607.html
"Mark Rae" <mark@.markN-O-S-P-A-M.co.uk> wrote in message
news:OjkCr%23AdGHA.4276@.TK2MSFTNGP03.phx.gbl...
> "Mantorok" <spamthis@.spam.com> wrote in message
> news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk ...
>> I've just been told that closing your browser closes your session on the
>> web-site you are viewing, is this true?
> Totally untrue. If you want to make sure that a session is closed, you
> need to provide a mechanism for a user to initiate it i.e. some sort of
> "Log out" facility which tears down the session. The server is simply
> waiting to respond to requests from clients - it cannot know when a
> browser has been closed.

Thank you for clarifying my thoughts, when I first heard it I immediately
said "How does the server know the client closed the browser?", silenced
followed.....

Cheers
Kev
"Mark Rae" <mark@.markN-O-S-P-A-M.co.uk> wrote in message
news:OjkCr%23AdGHA.4276@.TK2MSFTNGP03.phx.gbl...
> "Mantorok" <spamthis@.spam.com> wrote in message
> news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk ...
>> I've just been told that closing your browser closes your session on the
>> web-site you are viewing, is this true?
> Totally untrue. If you want to make sure that a session is closed, you
> need to provide a mechanism for a user to initiate it i.e. some sort of
> "Log out" facility which tears down the session. The server is simply
> waiting to respond to requests from clients - it cannot know when a
> browser has been closed.

Come to think of it - when I log in to my (internal) web-site it stores my
login in a session variable, however when I close the browser and re-open my
login session has gone.

What's happening here?

Thanks
Kev
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e3sbfk$6br$1@.newsfeed.th.ifl.net...

> Come to think of it - when I log in to my (internal) web-site it stores my
> login in a session variable, however when I close the browser and re-open
> my login session has gone.
> What's happening here?

Opening the browser again causes a new session to be created.
"Mark Rae" <mark@.markN-O-S-P-A-M.co.uk> wrote in message
news:Oy$AtTBdGHA.4912@.TK2MSFTNGP05.phx.gbl...
> "Mantorok" <mantorok@.mantorok.com> wrote in message
> news:e3sbfk$6br$1@.newsfeed.th.ifl.net...
>> Come to think of it - when I log in to my (internal) web-site it stores
>> my login in a session variable, however when I close the browser and
>> re-open my login session has gone.
>>
>> What's happening here?
> Opening the browser again causes a new session to be created.

Aha, thanks.

Kev
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e3scup$71j$1@.newsfeed.th.ifl.net...

> Aha, thanks.

http://www.google.com/search?source...22+IsNewSession
Covering a few items in this thread:

Closing your browser does nothing on the server. The server still waits
until timeout to get rid of the session. And, opening a browser creates a
new session. This means you now have two sessions, but you are only
connected to the newest session.

The way this works is through a session cookie, or server cookie. Even users
with normal cookies off can get these. There are some older browsers that
see both types of cookies as the same. And, yes, an industrious user can
refuse server cookies, as well. But it is rare.

When you open the browser, it will not reuse a server cookie, even if the
session has not timed out. This is for security purposes. So, it creates a
new connection and gets a new server cookie (session). If you open and close
the browser 100 times, you have 100 sessions until they time out, but you
cannot get to any for which you have closed the browser.

Another interesting topic. If you open a new browser instance using Control
+ N, both connect to the same session. If you use the menu, you have two
different sessions. Cool, eh?

Remember, the web is stateless, so it has no clue what the user is doing.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"Mantorok" <spamthis@.spam.com> wrote in message
news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk ...
> Hi
> I've just been told that closing your browser closes your session on the
> web-site you are viewing, is this true? If so, is this the browser that
> initiates the closure, or the server?
> Thanks
> Kev
Cowboy,

Very good.

How? an industrious user can
refuse server cookies, as well. But it is rare.

more details please thanks for the education

SA

"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@.comcast.netNoSpamM> wrote in
message news:eeghAWCdGHA.5048@.TK2MSFTNGP04.phx.gbl...
> Covering a few items in this thread:
> Closing your browser does nothing on the server. The server still waits
> until timeout to get rid of the session. And, opening a browser creates a
> new session. This means you now have two sessions, but you are only
> connected to the newest session.
> The way this works is through a session cookie, or server cookie. Even
> users with normal cookies off can get these. There are some older browsers
> that see both types of cookies as the same. And, yes, an industrious user
> can refuse server cookies, as well. But it is rare.
> When you open the browser, it will not reuse a server cookie, even if the
> session has not timed out. This is for security purposes. So, it creates a
> new connection and gets a new server cookie (session). If you open and
> close the browser 100 times, you have 100 sessions until they time out,
> but you cannot get to any for which you have closed the browser.
> Another interesting topic. If you open a new browser instance using
> Control + N, both connect to the same session. If you use the menu, you
> have two different sessions. Cool, eh?
> Remember, the web is stateless, so it has no clue what the user is doing.
> --
> Gregory A. Beamer
> *************************************************
> Think Outside the Box!
> *************************************************
> "Mantorok" <spamthis@.spam.com> wrote in message
> news:cbc5da882bbc88c8422cf73e68ca@.news.rmplc.co.uk ...
>> Hi
>>
>> I've just been told that closing your browser closes your session on the
>> web-site you are viewing, is this true? If so, is this the browser that
>> initiates the closure, or the server?
>>
>> Thanks
>> Kev
>>
>>

Thursday, March 29, 2012

Session varaibles are lost when an error occurs

In VS2003, when debugging (with breakpoints set) a ASP.net web project
(locally), if an error/exception occurs the browser navigates to the "Server
Error" page. After this point it looses all the values stored in the Session
objects, and leads to many other errors, before I must refresh the page and
restart all over again. What the problem can be?
Thanks in advance.Hi,
Before redirecting to the error page the current session is distroyed and a
new session is created. This is the ASP.NET behavior. What you can do is to
catch all unhandled exceptions in the Application_Error from Global file. In
this handler you should clean the error and manually redirect to your custom
error page using Server.Transfer method. This way you prevent the
application from distroying the session.
"So" <.> wrote in message news:O38eKVIUFHA.2712@.TK2MSFTNGP09.phx.gbl...
> In VS2003, when debugging (with breakpoints set) a ASP.net web project
> (locally), if an error/exception occurs the browser navigates to the
"Server
> Error" page. After this point it looses all the values stored in the
Session
> objects, and leads to many other errors, before I must refresh the page
and
> restart all over again. What the problem can be?
> Thanks in advance.
>
Thanks for your reply. Sorry for getting back late.
I tried to do something like this below in global.asax.vb, but I am still
loosing the Session variables. Note that I am not redirecting to any error
page at the moment. What more can be done, and where (on web/docu) can I
read in good details about the ASP.net session handling?
Protected Sub Application_Error(ByVal sender As [Object], ByVal e As
EventArgs)
Dim objErr As Exception =
Server.GetLastError().GetBaseException()
Server.ClearError()
Dim err As String = "<b>Error Caught in Application_Error
event</b><hr><br>" & _
"<br><b>Error in: </b>" &
Request.Url.ToString() & _
"<br><b>Error Message: </b>" &
objErr.Message.ToString() & _
"<br><b>Stack Trace:</b><br>" &
objErr.StackTrace.ToString().Replace("at ", "<br>at ") & _
"<br><a
href='java script:window.location.reload()'>Refresh</a>"
Response.Write(err.ToString())
End Sub
Thanks again for your time.
"Mircea Pleteriu" <mpleteriu@.newsgroup.nospam> schrieb im Newsbeitrag
news:eO46FqJUFHA.228@.TK2MSFTNGP12.phx.gbl...
> Hi,
> Before redirecting to the error page the current session is distroyed and
a
> new session is created. This is the ASP.NET behavior. What you can do is
to
> catch all unhandled exceptions in the Application_Error from Global file.
In
> this handler you should clean the error and manually redirect to your
custom
> error page using Server.Transfer method. This way you prevent the
> application from distroying the session.
> "So" <.> wrote in message news:O38eKVIUFHA.2712@.TK2MSFTNGP09.phx.gbl...
> "Server
> Session
> and
>

Session varaibles are lost when an error occurs

In VS2003, when debugging (with breakpoints set) a ASP.net web project
(locally), if an error/exception occurs the browser navigates to the "Server
Error" page. After this point it looses all the values stored in the Session
objects, and leads to many other errors, before I must refresh the page and
restart all over again. What the problem can be?

Thanks in advance.Hi,

Before redirecting to the error page the current session is distroyed and a
new session is created. This is the ASP.NET behavior. What you can do is to
catch all unhandled exceptions in the Application_Error from Global file. In
this handler you should clean the error and manually redirect to your custom
error page using Server.Transfer method. This way you prevent the
application from distroying the session.

"So" <.> wrote in message news:O38eKVIUFHA.2712@.TK2MSFTNGP09.phx.gbl...
> In VS2003, when debugging (with breakpoints set) a ASP.net web project
> (locally), if an error/exception occurs the browser navigates to the
"Server
> Error" page. After this point it looses all the values stored in the
Session
> objects, and leads to many other errors, before I must refresh the page
and
> restart all over again. What the problem can be?
> Thanks in advance.

Session variable

Hello,

I have a form with a button that opens a new browser with another form. I
want to be able to change a session variable before the new form is loaded.
Can this be done? If yes, how? Thank you in advance and your help is greatly
appreciated.Uytkownik "James" <james@.nodomain.netnapisa w wiadomoci
news:%23orOxZppGHA.3324@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Hello,
>
>
I have a form with a button that opens a new browser with another form. I
want to be able to change a session variable before the new form is
loaded. Can this be done? If yes, how? Thank you in advance and your help
is greatly appreciated.


For me there is only one solution. On the second page in Page_Load method
change this variable.

--
JS
BRE Bank Dev Team, Poland
You would put all the code in the server-side button click handler. e.g.,

Session["myValue"]="new value";
Response.Write("<script>window.Open("hewpage.aspx");</script>");

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"James" wrote:

Quote:

Originally Posted by

Hello,
>
>
I have a form with a button that opens a new browser with another form. I
want to be able to change a session variable before the new form is loaded.
Can this be done? If yes, how? Thank you in advance and your help is greatly
appreciated.
>
>
>


It's good to know people who know what they are doing!

Thanks, it worked great!

"Peter Bromberg [C# MVP]" <pbromberg@.yahoo.nospammin.comwrote in message
news:F6B66951-B4B5-4F69-A709-F163BA74EAA1@.microsoft.com...

Quote:

Originally Posted by

You would put all the code in the server-side button click handler. e.g.,
>
Session["myValue"]="new value";
Response.Write("<script>window.Open("hewpage.aspx");</script>");
>
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"James" wrote:
>

Quote:

Originally Posted by

>Hello,
>>
>>
>I have a form with a button that opens a new browser with another form. I
>want to be able to change a session variable before the new form is
>loaded.
>Can this be done? If yes, how? Thank you in advance and your help is
>greatly
>appreciated.
>>
>>
>>

Monday, March 26, 2012

session variable expire too quickly

Hi all
when i log onto my asp.net website through a browser , the session variables
are expiring way too quickly. if i leave the screen for only a minute,
everything is gone.
it seems like some pages are worse than others...
the session timeout is set to 20mins, but still they are expiring after only
a minute...
what should i do'
--
AdamPC@dotnet.itags.org.hotmail.comread my resonse to the first post you made on this one... lots of stuff out
there.
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"ACaunter" <AdamPC@.hotmail.com> wrote in message
news:73D329BF-E42C-465A-B9BF-864327266347@.microsoft.com...
> Hi all
> when i log onto my asp.net website through a browser , the session
> variables
> are expiring way too quickly. if i leave the screen for only a minute,
> everything is gone.
> it seems like some pages are worse than others...
> the session timeout is set to 20mins, but still they are expiring after
> only
> a minute...
> what should i do'
> --
> AdamPC@.hotmail.com

session variable expire too quickly

Hi all
when i log onto my asp.net website through a browser , the session variables
are expiring way too quickly. if i leave the screen for only a minute,
everything is gone.
it seems like some pages are worse than others...
the session timeout is set to 20mins, but still they are expiring after only
a minute...

what should i do??
--
AdamPC@dotnet.itags.org.hotmail.comread my resonse to the first post you made on this one... lots of stuff out
there.

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com

"ACaunter" <AdamPC@.hotmail.com> wrote in message
news:73D329BF-E42C-465A-B9BF-864327266347@.microsoft.com...
> Hi all
> when i log onto my asp.net website through a browser , the session
> variables
> are expiring way too quickly. if i leave the screen for only a minute,
> everything is gone.
> it seems like some pages are worse than others...
> the session timeout is set to 20mins, but still they are expiring after
> only
> a minute...
> what should i do??
> --
> AdamPC@.hotmail.com

Saturday, March 24, 2012

Session variable question

Hi

If I use session variables does this depends on cookies being sent to the
client browser? If yes then what happens if the user disable cookies?

ThanksYes, then it wont work
but you can work cookieless sending the session id in the url

"RA" <ron_a1@.hotmail.com> wrote in message
news:uHIYDF7%23DHA.3272@.TK2MSFTNGP09.phx.gbl...
> Hi
> If I use session variables does this depends on cookies being sent to the
> client browser? If yes then what happens if the user disable cookies?
>
> Thanks
"EricJ" <ericReMoVe@.ThiSbitconsult.be.RE> wrote in message
news:403cbba2$0$785$ba620e4c@.news.skynet.be...
> Yes, then it wont work
> but you can work cookieless sending the session id in the url

How would you do this? I am using asp.net with c#

Thanks
> "RA" <ron_a1@.hotmail.com> wrote in message
> news:uHIYDF7%23DHA.3272@.TK2MSFTNGP09.phx.gbl...
> > Hi
> > If I use session variables does this depends on cookies being sent to
the
> > client browser? If yes then what happens if the user disable cookies?
> > Thanks
http://msdn.microsoft.com/library/d...asp12282000.asp
Session configuration
Below is a sample config.web file used to configure the session state
settings for an ASP.NET application:

<configuration>
<sessionstate
mode="inproc"
cookieless="false"
timeout="20"
sqlconnectionstring="data source=127.0.0.1;user id=sa;password="
server="127.0.0.1"
port="42424"
/>
</configuration>
The settings above are used to configure ASP.NET session state. Let's look
at each in more detail and cover the various uses afterward.

a.. Mode. The mode setting supports three options: inproc, sqlserver, and
stateserver. As stated earlier, ASP.NET supports two modes: in process and
out of process. There are also two options for out-of-process state
management: memory based (stateserver), and SQL Server based (sqlserver).
We'll discuss implementing these options shortly.
b.. Cookieless. The cookieless option for ASP.NET is configured with this
simple Boolean setting.
c.. Timeout. This option controls the length of time a session is
considered valid. The session timeout is a sliding value; on each request
the timeout period is set to the current time plus the timeout value
d.. Sqlconnectionstring. The sqlconnectionstring identifies the database
connection string that names the database used for mode sqlserver.
e.. Server. In the out-of-process mode stateserver, it names the server
that is running the required Windows NT service: ASPState.
f.. Port. The port setting, which accompanies the server setting,
identifies the port number that corresponds to the server setting for mode
stateserver.
"RA" <ron_a1@.hotmail.com> wrote in message
news:OUtUpn7%23DHA.2592@.TK2MSFTNGP10.phx.gbl...
> "EricJ" <ericReMoVe@.ThiSbitconsult.be.RE> wrote in message
> news:403cbba2$0$785$ba620e4c@.news.skynet.be...
> > Yes, then it wont work
> > but you can work cookieless sending the session id in the url
> How would you do this? I am using asp.net with c#
> Thanks
> > "RA" <ron_a1@.hotmail.com> wrote in message
> > news:uHIYDF7%23DHA.3272@.TK2MSFTNGP09.phx.gbl...
> > > Hi
> > > > If I use session variables does this depends on cookies being sent to
> the
> > > client browser? If yes then what happens if the user disable cookies?
> > > > > Thanks
> >
I have found a way to remove the session id in the url and still use
session variables throughout your web application.

In your web.config set the cookieless variable to false and create a
pages tag. See code below:

<pages buffer="true"
enableSessionState="true" /
<sessionState
... some other code
cookieless="false"
.... some other code
/
this will make your url look like this : www.mywebsite.com instead of
http://www.mywebsite.com/(etoczb55d...55)/mypage.aspx and still be
able to use session varialbles in your project.

Good luck!!!

"RA" <ron_a1@.hotmail.com> wrote in message news:<uHIYDF7#DHA.3272@.TK2MSFTNGP09.phx.gbl>...
> Hi
> If I use session variables does this depends on cookies being sent to the
> client browser? If yes then what happens if the user disable cookies?
>
> Thanks
Sidd,

The problem with this is that it wont work if the user has cookies disabled!

Try what you mentioned but disable all cookies on your browser... it wont
work!

In a scenario like that, you need to have the session stored in the URL
(cookiless=true)

-ZD

The user's sessionID is stored in a cookie on the browswer so the server
knows which
"Sidd" <pfsedney@.impactvet.com> wrote in message
news:bdc17678.0402260859.1befe734@.posting.google.c om...
> I have found a way to remove the session id in the url and still use
> session variables throughout your web application.
> In your web.config set the cookieless variable to false and create a
> pages tag. See code below:
> <pages buffer="true"
> enableSessionState="true" />
> <sessionState
> ... some other code
> cookieless="false"
> .... some other code
> />
> this will make your url look like this : www.mywebsite.com instead of
> http://www.mywebsite.com/(etoczb55d...55)/mypage.aspx and still be
> able to use session varialbles in your project.
>
> Good luck!!!
> "RA" <ron_a1@.hotmail.com> wrote in message
news:<uHIYDF7#DHA.3272@.TK2MSFTNGP09.phx.gbl>...
> > Hi
> > If I use session variables does this depends on cookies being sent to
the
> > client browser? If yes then what happens if the user disable cookies?
> > Thanks

Thursday, March 22, 2012

Session Variables

How long does it take a session variable to expire or loose its value, or
it the value stored until the client closes the browser window?

TIAHi TC,

The default is 20 minutes after the last request from the client. As the
server has no way of knowing what the client does after receiving a request,
it is not dependent upon the client.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"TC" <tcordonb@.hotmail.com> wrote in message
news:ufzuTyjhFHA.2072@.TK2MSFTNGP14.phx.gbl...
> How long does it take a session variable to expire or loose its value, or
> it the value stored until the client closes the browser window?
> TIA
How can I change this, or do I have to validate in every page that the
session variable still has some value?

Thanks

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:eSuXaIkhFHA.1444@.TK2MSFTNGP10.phx.gbl...
> Hi TC,
> The default is 20 minutes after the last request from the client. As the
> server has no way of knowing what the client does after receiving a
> request, it is not dependent upon the client.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> Ambiguity has a certain quality to it.
> "TC" <tcordonb@.hotmail.com> wrote in message
> news:ufzuTyjhFHA.2072@.TK2MSFTNGP14.phx.gbl...
>> How long does it take a session variable to expire or loose its value,
>> or it the value stored until the client closes the browser window?
>>
>> TIA
>>
>>
Hi TC,

As Sessions time out (and you can't change that, only the time interval), it
is ALWAYS a good idea to check for and handle the eventuality that some
Sessions will time out. Changing the timeout is usually a bad idea, as it
causes more memory usage on the server. Each Session allocates memory, and
the more Sessions that are alive, the more memory will be used at any given
point.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"TC" <tcordonb@.hotmail.com> wrote in message
news:umLolPmhFHA.1048@.tk2msftngp13.phx.gbl...
> How can I change this, or do I have to validate in every page that the
> session variable still has some value?
> Thanks
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:eSuXaIkhFHA.1444@.TK2MSFTNGP10.phx.gbl...
>> Hi TC,
>>
>> The default is 20 minutes after the last request from the client. As the
>> server has no way of knowing what the client does after receiving a
>> request, it is not dependent upon the client.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> Ambiguity has a certain quality to it.
>>
>> "TC" <tcordonb@.hotmail.com> wrote in message
>> news:ufzuTyjhFHA.2072@.TK2MSFTNGP14.phx.gbl...
>>> How long does it take a session variable to expire or loose its value,
>>> or it the value stored until the client closes the browser window?
>>>
>>> TIA
>>>
>>>
>>
>>

Tuesday, March 13, 2012

Session Variables - why aren't novice developers warned?

When a user opens a new IE browser window using File-New-Window the
integrity of an application which relies on session state is COMPLETELY
undermined. Anyone who overlooks the fact that File-New-Window creates an
instance of IE in the same process with the same SessionID as the parent
window is in big trouble. This fundamentally restricts the usefullness of
using session state management.
I probably missed it somewhere - can someone please help me find where in
the Visual Studio 2005 documentation this pitfall is PLAINLY mentioned?
Such that developers sing basic guidance will not fail to note the
warning? There are articles which explain elementary concepts such as how
to create a session variable, without pointing out this serious hazard.
I have read the articles entitled Session State Overview, Session
Identifiers, Session State Events, etc. and I can't find this trap openly
described. For example, the article ASP.NET State Management
Recommendations identifies only performance considerations in the
Divantage of Using Session State section.
Why aren't developers warned of this while the basics of ASP.NET development
are being explained?
I agree that the injudicious use of global variables in any type of
application is sloppy and can incur pitfalls. However, in most types of
applications global variables are limited in scope to the instance of the
application. If there are multiple instances of the same application open
on one machine, each instance has its own scope. I think many (most?) asp
developers may have naive expectations that this is the case when using
session variables in an asp application hosted by Internet Explorer. I did.
-Bill
"GroupReader" <newsgroups_01@dotnet.itags.org.hotmail.com> wrote in message
news:1161148121.175510.124660@dotnet.itags.org.b28g2000cwb.googlegroups.com...
> You'll have these issues *any* time you use global variables in *any*
> type of application. It's best to use local variables whenever
> possible. In asp.net this translates to passing your variables around
> from form to form. Use querystring variables or form variables
> instead. Sorry I don't have a decent solution, but one more thought:
> I think your issue may get worse when IE7 introduces "tabbed
> browsing"... which makes it much easier to "open new windows". Maybe
> there's an IE setting that tells IE to start a new session when a new
> window is opened(?)
>Bill,
Unfortunatley, that's not the job of documentation. The docs are
meant to instruct on a particular subject, not to speculate on the pros and
cons. There are plenty of articles out there as well as books that discuss
these pros and cons in-depth. The pros and cons have been discussed now for
the better part of a decade so the information is there, it's just not the
place of the documentation to inform you of comparisons with other
technologies and with the pros and cons. It's the docs job simply to explain
and instruct on the particular topic. Before attempting to implement
something new, it's always useful to s out some of the info that's out
there on a topic. For example, there are plenty of articles out there on
session variables, how to use them in web-farms, high-jacking of cookiless
sessions, etc., as developers we just need to s them out as the docs are
never the be-all and end-all on a subject.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"BillE" <belgie@.datamti.com> wrote in message
news:OZ2foZr8GHA.2288@.TK2MSFTNGP05.phx.gbl...
> When a user opens a new IE browser window using File-New-Window the
> integrity of an application which relies on session state is COMPLETELY
> undermined. Anyone who overlooks the fact that File-New-Window creates
> an instance of IE in the same process with the same SessionID as the
> parent window is in big trouble. This fundamentally restricts the
> usefullness of using session state management.
>
> I probably missed it somewhere - can someone please help me find where in
> the Visual Studio 2005 documentation this pitfall is PLAINLY mentioned?
> Such that developers sing basic guidance will not fail to note the
> warning? There are articles which explain elementary concepts such as how
> to create a session variable, without pointing out this serious hazard.
>
> I have read the articles entitled Session State Overview, Session
> Identifiers, Session State Events, etc. and I can't find this trap openly
> described. For example, the article ASP.NET State Management
> Recommendations identifies only performance considerations in the
> Divantage of Using Session State section.
>
> Why aren't developers warned of this while the basics of ASP.NET
> development are being explained?
> I agree that the injudicious use of global variables in any type of
> application is sloppy and can incur pitfalls. However, in most types of
> applications global variables are limited in scope to the instance of the
> application. If there are multiple instances of the same application open
> on one machine, each instance has its own scope. I think many (most?) asp
> developers may have naive expectations that this is the case when using
> session variables in an asp application hosted by Internet Explorer. I
> did.
>
> -Bill
>
> "GroupReader" <newsgroups_01@.hotmail.com> wrote in message
> news:1161148121.175510.124660@.b28g2000cwb.googlegroups.com...
>
Thanks for your response Mark.
I would ask why it is not a fundamental role of the Visual Studio
documentation to identify the potentially damaging risks associated with the
use of Session Variables?
I think it is a basic role of documentation to point out potential pitfalls
and provide guidance on correct usage.
Thanks!
Bill
"Mark Fitzpatrick" <markfitz@.fitzme.com> wrote in message
news:%23i1s3or8GHA.4572@.TK2MSFTNGP02.phx.gbl...
> Bill,
> Unfortunatley, that's not the job of documentation. The docs are
> meant to instruct on a particular subject, not to speculate on the pros
> and cons. There are plenty of articles out there as well as books that
> discuss these pros and cons in-depth. The pros and cons have been
> discussed now for the better part of a decade so the information is there,
> it's just not the place of the documentation to inform you of comparisons
> with other technologies and with the pros and cons. It's the docs job
> simply to explain and instruct on the particular topic. Before attempting
> to implement something new, it's always useful to s out some of the
> info that's out there on a topic. For example, there are plenty of
> articles out there on session variables, how to use them in web-farms,
> high-jacking of cookiless sessions, etc., as developers we just need to
> s them out as the docs are never the be-all and end-all on a subject.
>
> --
> Hope this helps,
> Mark Fitzpatrick
> Former Microsoft FrontPage MVP 199...2006
> "BillE" <belgie@.datamti.com> wrote in message
> news:OZ2foZr8GHA.2288@.TK2MSFTNGP05.phx.gbl...
>
I am sure we can all identify hundreds of ways that a novice could screw up
their entire application. It does not mean that MS can identify or document
all of them.
It is best to not make assumptions and to research how things work before
relying on them. That is what the job of a developer is - and sometimes you
can only learn by making mistakes. You don't put the blame on others.
"BillE" <belgie@.datamti.com> wrote in message
news:%23L4PAyr8GHA.4116@.TK2MSFTNGP03.phx.gbl...
> Thanks for your response Mark.
> I would ask why it is not a fundamental role of the Visual Studio
> documentation to identify the potentially damaging risks associated with
> the use of Session Variables?
> I think it is a basic role of documentation to point out potential
> pitfalls and provide guidance on correct usage.
> Thanks!
> Bill
>
> "Mark Fitzpatrick" <markfitz@.fitzme.com> wrote in message
> news:%23i1s3or8GHA.4572@.TK2MSFTNGP02.phx.gbl...
>
Marina, I certainly agree with everything you say - particularly in not
putting the blame on others!
However, I also feel that this potential hazard is severe enough that it
should be explicitly identified as a divantage. Worst of all, it is a
shortcoming that can go undetected, compromising data until finally noticed.
I expect there may be countless ASP applications deployed which are silently
adding orders to the wrong customer and the like because the developer did
not stumble across this issue.
You can research session state very thoroughly without finding any reference
to this damaging problem.
Respectfully, can you tell me where this issue is raised in MSDN, for
example, so that a developer responsibly researching the use of session
state prior to implementation would be likely to find it? Search on
"session state divantages" for example - performance is the only
divantage mentioned.
Thanks!
Bill
"Marina Levit [MVP]" <someone@.nospam.com> wrote in message
news:O%23AAO2r8GHA.940@.TK2MSFTNGP03.phx.gbl...
>I am sure we can all identify hundreds of ways that a novice could screw up
>their entire application. It does not mean that MS can identify or document
>all of them.
> It is best to not make assumptions and to research how things work before
> relying on them. That is what the job of a developer is - and sometimes
> you can only learn by making mistakes. You don't put the blame on others.
> "BillE" <belgie@.datamti.com> wrote in message
> news:%23L4PAyr8GHA.4116@.TK2MSFTNGP03.phx.gbl...
>
"BillE" <belgie@.datamti.com> wrote in message
news:et7L5Es8GHA.2120@.TK2MSFTNGP03.phx.gbl...

> I expect there may be countless ASP applications deployed which are
> silently adding orders to the wrong customer and the like because the
> developer did not stumble across this issue.
I feel that, if that were indeed the case, then it would be down to woefully
inadequate (more like non-existent!) testing...

> You can research session state very thoroughly without finding any
> reference to this damaging problem.
http://www.google.co.uk/search?sour...&q=IsNewSession
http://www.google.co.uk/search?sour...22new+window%22
Also this is a browser dependant problem, not really something caused by VS/
ASP.NET. Plus this is not necessarily a problem for most of us...
What is your scenario ?
Patrice
"BillE" <belgie@.datamti.com> a crit dans le message de news:
et7L5Es8GHA.2120@.TK2MSFTNGP03.phx.gbl...
> Marina, I certainly agree with everything you say - particularly in not
> putting the blame on others!
> However, I also feel that this potential hazard is severe enough that it
> should be explicitly identified as a divantage. Worst of all, it is a
> shortcoming that can go undetected, compromising data until finally
> noticed. I expect there may be countless ASP applications deployed which
> are silently adding orders to the wrong customer and the like because the
> developer did not stumble across this issue.
> You can research session state very thoroughly without finding any
> reference to this damaging problem.
> Respectfully, can you tell me where this issue is raised in MSDN, for
> example, so that a developer responsibly researching the use of session
> state prior to implementation would be likely to find it? Search on
> "session state divantages" for example - performance is the only
> divantage mentioned.
> Thanks!
> Bill
>
> "Marina Levit [MVP]" <someone@.nospam.com> wrote in message
> news:O%23AAO2r8GHA.940@.TK2MSFTNGP03.phx.gbl...
>
Possibly, Mark, but I think that even thorough testers might overlook the
possibility of clicking File-New-Window in Internet Explorer if they weren't
previously aware that it could cause problems. After all, they are testing
the application, not the behavior of Internet Explorer!
Which returns to the main point - how is a developer / tester to become
aware of this pitfall? The only way I can find reference to the problem it
is by specifically searching on something which implies prior knowledge of
the problem (like "Internet Explorer File New Window").
I appreciate the dialog.
Bill
"Mark Rae" <mark@.markNOSPAMrae.com> wrote in message
news:eB$KDOs8GHA.4644@.TK2MSFTNGP04.phx.gbl...
> "BillE" <belgie@.datamti.com> wrote in message
> news:et7L5Es8GHA.2120@.TK2MSFTNGP03.phx.gbl...
>
> I feel that, if that were indeed the case, then it would be down to
> woefully inadequate (more like non-existent!) testing...
>
> http://www.google.co.uk/search?sour...&q=IsNewSession
> http://www.google.co.uk/search?sour...22new+window%22
>
"BillE" <belgie@.datamti.com> wrote in message
news:uiKMIWs8GHA.4012@.TK2MSFTNGP04.phx.gbl...

> Possibly, Mark, but I think that even thorough testers might overlook the
> possibility of clicking File-New-Window in Internet Explorer if they
> weren't previously aware that it could cause problems. After all, they
> are testing the application, not the behavior of Internet Explorer!
Then they need to be testing the application under the various different
functional scenarios of the platform it's running under...
Opening a new window is just one of these. Same as the effect of turning
JavaScript off, etc...

> Which returns to the main point - how is a developer / tester to become
> aware of this pitfall?
Trial and error. Every new runtime scenario encountered by the development /
testing team gets added to the knowledge pool...
this problem falls into the same catergory, as the following problems
1) browser refresh - not handling a refresh of the page
2) double submit problem - not handling double second click while waiting
for render
3) use of static/vb modules to store session data
4) bloated viewstate
5) not understanding the page lifecyyle - page load fires on render and
postback, and before event firing.
all this problems are pretty easy to predict if the dev takes the time to
lean how a web applications work and its stateless nature.
-- bruce (sqlwork.com)
"BillE" <belgie@.datamti.com> wrote in message
news:OZ2foZr8GHA.2288@.TK2MSFTNGP05.phx.gbl...
> When a user opens a new IE browser window using File-New-Window the
> integrity of an application which relies on session state is COMPLETELY
> undermined. Anyone who overlooks the fact that File-New-Window creates
> an instance of IE in the same process with the same SessionID as the
> parent window is in big trouble. This fundamentally restricts the
> usefullness of using session state management.
>
> I probably missed it somewhere - can someone please help me find where in
> the Visual Studio 2005 documentation this pitfall is PLAINLY mentioned?
> Such that developers sing basic guidance will not fail to note the
> warning? There are articles which explain elementary concepts such as how
> to create a session variable, without pointing out this serious hazard.
>
> I have read the articles entitled Session State Overview, Session
> Identifiers, Session State Events, etc. and I can't find this trap openly
> described. For example, the article ASP.NET State Management
> Recommendations identifies only performance considerations in the
> Divantage of Using Session State section.
>
> Why aren't developers warned of this while the basics of ASP.NET
> development are being explained?
> I agree that the injudicious use of global variables in any type of
> application is sloppy and can incur pitfalls. However, in most types of
> applications global variables are limited in scope to the instance of the
> application. If there are multiple instances of the same application open
> on one machine, each instance has its own scope. I think many (most?) asp
> developers may have naive expectations that this is the case when using
> session variables in an asp application hosted by Internet Explorer. I
> did.
>
> -Bill
>
> "GroupReader" <newsgroups_01@.hotmail.com> wrote in message
> news:1161148121.175510.124660@.b28g2000cwb.googlegroups.com...
>