Saturday, March 31, 2012
Session Timeouts
set IIS to timout in 40 minutes (asp.net|configuration) and it works just
fine - the app won't timeout until 40 minutes of inactivity passes.
However when deployed to a production server2003 machine with the very same
IIS settings, the app times out in 20 minutes. I have no specific timeout
statement either in code or web.config.
Any ideas?
Regards,
Gary BlakelyOn May 25, 6:48 am, "GaryDean" <GaryD...@.newsgroups.nospam> wrote:
> I have developed an asp.net 2.0 app on my instance of server2003 and have
> set IIS to timout in 40 minutes (asp.net|configuration) and it works just
> fine - the app won't timeout until 40 minutes of inactivity passes.
> However when deployed to a production server2003 machine with the very sam
e
> IIS settings, the app times out in 20 minutes. I have no specific timeout
> statement either in code or web.config.
> Any ideas?
> --
> Regards,
> Gary Blakely
Hi Gary...
20 min is a default timeout period...
please add timeout configuration in web.config and set it to 40 min...
if this problem still remains please check your machine.config
file...
Thanks
Masudur
I guess I failed to say that I have tried all of the obvious solutions, some
of which, you suggest.
Regards,
Gary Blakely
"Masudur" <munnacs@.gmail.com> wrote in message
news:1180069599.240101.129060@.g4g2000hsf.googlegroups.com...
> On May 25, 6:48 am, "GaryDean" <GaryD...@.newsgroups.nospam> wrote:
> Hi Gary...
> 20 min is a default timeout period...
> please add timeout configuration in web.config and set it to 40 min...
> if this problem still remains please check your machine.config
> file...
> Thanks
> Masudur
>
On May 27, 6:53 pm, "GaryDean" <GaryD...@.newsgroups.nospam> wrote:
> I guess I failed to say that I have tried all of the obvious solutions, so
me
> of which, you suggest.
>
So, did you tried to set timeout in the web.config file?
<sessionState mode="InProc"
cookieless="true"
timeout="40"/>
Hi Gary,
This issue does look strange, if you're pretty sure that the obvious
web.config settings and IIS settings are correctly configured:
1) web.config, see Alexey's suggestion.
2) IIS: virtual directory properties -> (Directory) Configuration ->
(Options) "Session timeout".
Maybe we're lack of some context or background information, would you
please depict more on the other configuration settings your web site
having? Thanks.
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Walter,
Is there some reason cookieless="true" has to be coupled with the timeout
setting?
BTW, are there any downsides to cookieless sessions other than having the
sessionID in the url?
Regards,
Gary Blakely
"Walter Wang [MSFT]" <wawang@.online.microsoft.com> wrote in message
news:3X3TzCZoHHA.1144@.TK2MSFTNGHUB02.phx.gbl...
> Hi Gary,
> This issue does look strange, if you're pretty sure that the obvious
> web.config settings and IIS settings are correctly configured:
> 1) web.config, see Alexey's suggestion.
> 2) IIS: virtual directory properties -> (Directory) Configuration ->
> (Options) "Session timeout".
>
> Maybe we're lack of some context or background information, would you
> please depict more on the other configuration settings your web site
> having? Thanks.
>
> Regards,
> Walter Wang (wawang@.online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
also, this is a little strange...
if iis is set to 20 and my web.config says timeout="40" at 22 minutes of no
activity the user does not get the login screen, the session variables are
just null.
Regards,
Gary Blakely
"Walter Wang [MSFT]" <wawang@.online.microsoft.com> wrote in message
news:3X3TzCZoHHA.1144@.TK2MSFTNGHUB02.phx.gbl...
> Hi Gary,
> This issue does look strange, if you're pretty sure that the obvious
> web.config settings and IIS settings are correctly configured:
> 1) web.config, see Alexey's suggestion.
> 2) IIS: virtual directory properties -> (Directory) Configuration ->
> (Options) "Session timeout".
>
> Maybe we're lack of some context or background information, would you
> please depict more on the other configuration settings your web site
> having? Thanks.
>
> Regards,
> Walter Wang (wawang@.online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
I have new information and I am going to start a new thread on this
Regards,
Gary Blakely
"Walter Wang [MSFT]" <wawang@.online.microsoft.com> wrote in message
news:3X3TzCZoHHA.1144@.TK2MSFTNGHUB02.phx.gbl...
> Hi Gary,
> This issue does look strange, if you're pretty sure that the obvious
> web.config settings and IIS settings are correctly configured:
> 1) web.config, see Alexey's suggestion.
> 2) IIS: virtual directory properties -> (Directory) Configuration ->
> (Options) "Session timeout".
>
> Maybe we're lack of some context or background information, would you
> please depict more on the other configuration settings your web site
> having? Thanks.
>
> Regards,
> Walter Wang (wawang@.online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
Session Timeouts
set IIS to timout in 40 minutes (asp.net|configuration) and it works just
fine - the app won't timeout until 40 minutes of inactivity passes.
However when deployed to a production server2003 machine with the very same
IIS settings, the app times out in 20 minutes. I have no specific timeout
statement either in code or web.config.
Any ideas?
--
Regards,
Gary BlakelyOn May 25, 6:48 am, "GaryDean" <GaryD...@.newsgroups.nospamwrote:
Quote:
Originally Posted by
I have developed an asp.net 2.0 app on my instance of server2003 and have
set IIS to timout in 40 minutes (asp.net|configuration) and it works just
fine - the app won't timeout until 40 minutes of inactivity passes.
>
However when deployed to a production server2003 machine with the very same
IIS settings, the app times out in 20 minutes. I have no specific timeout
statement either in code or web.config.
>
Any ideas?
>
--
Regards,
Gary Blakely
Hi Gary...
20 min is a default timeout period...
please add timeout configuration in web.config and set it to 40 min...
if this problem still remains please check your machine.config
file...
Thanks
Masudur
I guess I failed to say that I have tried all of the obvious solutions, some
of which, you suggest.
--
Regards,
Gary Blakely
"Masudur" <munnacs@.gmail.comwrote in message
news:1180069599.240101.129060@.g4g2000hsf.googlegro ups.com...
Quote:
Originally Posted by
On May 25, 6:48 am, "GaryDean" <GaryD...@.newsgroups.nospamwrote:
Quote:
Originally Posted by
>I have developed an asp.net 2.0 app on my instance of server2003 and have
>set IIS to timout in 40 minutes (asp.net|configuration) and it works just
>fine - the app won't timeout until 40 minutes of inactivity passes.
>>
>However when deployed to a production server2003 machine with the very
>same
>IIS settings, the app times out in 20 minutes. I have no specific
>timeout
>statement either in code or web.config.
>>
>Any ideas?
>>
>--
>Regards,
>Gary Blakely
>
Hi Gary...
>
20 min is a default timeout period...
please add timeout configuration in web.config and set it to 40 min...
if this problem still remains please check your machine.config
file...
>
Thanks
Masudur
>
On May 27, 6:53 pm, "GaryDean" <GaryD...@.newsgroups.nospamwrote:
Quote:
Originally Posted by
I guess I failed to say that I have tried all of the obvious solutions, some
of which, you suggest.
>
So, did you tried to set timeout in the web.config file?
<sessionState mode="InProc"
cookieless="true"
timeout="40"/>
Hi Gary,
This issue does look strange, if you're pretty sure that the obvious
web.config settings and IIS settings are correctly configured:
1) web.config, see Alexey's suggestion.
2) IIS: virtual directory properties -(Directory) Configuration ->
(Options) "Session timeout".
Maybe we're lack of some context or background information, would you
please depict more on the other configuration settings your web site
having? Thanks.
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Walter,
Is there some reason cookieless="true" has to be coupled with the timeout
setting?
BTW, are there any downsides to cookieless sessions other than having the
sessionID in the url?
--
Regards,
Gary Blakely
"Walter Wang [MSFT]" <wawang@.online.microsoft.comwrote in message
news:3X3TzCZoHHA.1144@.TK2MSFTNGHUB02.phx.gbl...
Quote:
Originally Posted by
Hi Gary,
>
This issue does look strange, if you're pretty sure that the obvious
web.config settings and IIS settings are correctly configured:
>
1) web.config, see Alexey's suggestion.
>
2) IIS: virtual directory properties -(Directory) Configuration ->
(Options) "Session timeout".
>
>
Maybe we're lack of some context or background information, would you
please depict more on the other configuration settings your web site
having? Thanks.
>
>
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
>
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
also, this is a little strange...
if iis is set to 20 and my web.config says timeout="40" at 22 minutes of no
activity the user does not get the login screen, the session variables are
just null.
--
Regards,
Gary Blakely
"Walter Wang [MSFT]" <wawang@.online.microsoft.comwrote in message
news:3X3TzCZoHHA.1144@.TK2MSFTNGHUB02.phx.gbl...
Quote:
Originally Posted by
Hi Gary,
>
This issue does look strange, if you're pretty sure that the obvious
web.config settings and IIS settings are correctly configured:
>
1) web.config, see Alexey's suggestion.
>
2) IIS: virtual directory properties -(Directory) Configuration ->
(Options) "Session timeout".
>
>
Maybe we're lack of some context or background information, would you
please depict more on the other configuration settings your web site
having? Thanks.
>
>
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
>
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
I have new information and I am going to start a new thread on this
--
Regards,
Gary Blakely
"Walter Wang [MSFT]" <wawang@.online.microsoft.comwrote in message
news:3X3TzCZoHHA.1144@.TK2MSFTNGHUB02.phx.gbl...
Quote:
Originally Posted by
Hi Gary,
>
This issue does look strange, if you're pretty sure that the obvious
web.config settings and IIS settings are correctly configured:
>
1) web.config, see Alexey's suggestion.
>
2) IIS: virtual directory properties -(Directory) Configuration ->
(Options) "Session timeout".
>
>
Maybe we're lack of some context or background information, would you
please depict more on the other configuration settings your web site
having? Thanks.
>
>
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
>
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
Thursday, March 29, 2012
Session value gone
http://www.dnzone.com/ShowDetail.asp?NewsId=565
This article may be of interest to you.
The easiest way is just to check on every page. If you want to get fancy, create a class implementing the IHttpModule interface and do it there.
NC...
Thanks you both, just copied same code to each page load event. Thanks.
What am I doing wrong? I put the following code and it doesn't show the alert screen.
If Session("companyID")="" Or Session("facilityID") = ""Then
'Generates the message:
Dim strMessageAsString
strMessage = "You have been inactive for more than 30 minutes. You must Login to Continue."
'finishes server processing, returns to client.
Dim strScriptAsString = "<script language=JavaScript>"
strScript += "alert(""" & strMessage & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegistered("clientScript"))Then
Page.RegisterStartupScript("clientScript", strScript)
Response.Redirect("LogIn.aspx")
EndIf
EndIf
FOR ANSWER GO HEREhttp://forums.asp.net/1100617/ShowPost.aspx
Try this in your global.asax code behind:
Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
Dim url As Array
url = HttpContext.Current.Request.Url.Segments
If IsNothing(Session("UserID")) Then
If url.IndexOf(url, "Login.aspx") = -1 Then
Response.Redirect("Login.aspx")
End If
End If
End Sub
This redirects anyone who does not have a Session("UserID"). If the request was to the login.aspx page, then we do nothing in order to avoid an infinate loop.
If you want to send them to an "Expired.htm" page, just add the following in the place of Response.Redirect("Login.aspx"):
If Session.IsNewSession Then
Response.Redirect("Login.aspx")
Else
Response.Redirect("Expired.htm")
End If
Hope this helps!
Paul
Ecc solution is the best but if you don't want to mess with the global.asax file then just create a secure base page that all your secured pages can inheirit from and then put the check in there or else you are going to have to modify all your pages if you ever need to make a change. Better to keep the code in one spot for maintenance purposes.
Monday, March 26, 2012
session variable getting lost
and it's in production.
My basic design is using Datatables created via the designer with a business
logic class in between the datatable and ObjectDataSources.
In one page I had a Gridview with select enabled. When an row in the grid is
selected, I retrieve the SelectedValue, store the value in a Session
variable and redirect the response to another web page, which, has an
ObjectDataSource on it and a DetailsView. The ObjectDataSource on this page
retrieves the value of the Session variable set from the first page. The
problem is that the Session variable is randomly losing its value.
So, the ObjectDataSource's Business object's SelectMethod accepts a value to
select records by. How do I know that the value is getting lost?
Because no rows are returned as:
dr = dtAdapter.Rows(0)
throws an exception IndexOutOfRange.
My question is, is there some reason that my session variable evaporates
randomly?
Thanks in advance
SAL"SAL" <SAL@.nospam.nospamwrote in message
news:u5$G%23JMIIHA.4712@.TK2MSFTNGP04.phx.gbl...
Quote:
Originally Posted by
My question is, is there some reason that my session variable evaporates
randomly?
No. Session variables will be lost when the Session times out, or when they
are overwritten / removed - does either of these situations apply here...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Mark, thanks for the reply.
I do not see either of these things applying here. This happened twice this
morning for no apparent reason and then it didn't happen. I have not changed
the time out so it should still be 20 minutes and I am not overwriting them
as far as I can see. I can not reproduce it on my machine.
S
"Mark Rae [MVP]" <mark@.markNOSPAMrae.netwrote in message
news:%237xKnRMIIHA.5056@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
"SAL" <SAL@.nospam.nospamwrote in message
news:u5$G%23JMIIHA.4712@.TK2MSFTNGP04.phx.gbl...
>
Quote:
Originally Posted by
>My question is, is there some reason that my session variable evaporates
>randomly?
>
No. Session variables will be lost when the Session times out, or when
they are overwritten / removed - does either of these situations apply
here...?
>
>
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Hi SAL,
Based on my understanding, you're redirecting to the second page right
after setting the session variable, right? If this is the case, there's no
reason the session variable will be lost due to session timeout. Could you
please double check if the session variable is really lost or it's because
the query that uses the variable to retrieve records from database returns
empty result?
By the way, there's another way to pass variables between pages using
Context.Items and Server.Transfer:
#Famil Jones : Pass Variables Between ASP.NET Pages
http://www.dotnetjunkies.com/WebLog...4/08/11020.aspx
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Hmmm, thank you for the replies all.
Would it be possible for Walter or someone else to comment on the load that
using the Server.Transfer pattern would place on the server? So, is there an
increased load on the server using this model as compared to using Session
variables?
Thanks
SAL
"SAL" <SAL@.nospam.nospamwrote in message
news:u$66KsMIIHA.3356@.TK2MSFTNGP02.phx.gbl...
Quote:
Originally Posted by
Mark, thanks for the reply.
I do not see either of these things applying here. This happened twice
this morning for no apparent reason and then it didn't happen. I have not
changed the time out so it should still be 20 minutes and I am not
overwriting them as far as I can see. I can not reproduce it on my
machine.
>
S
>
"Mark Rae [MVP]" <mark@.markNOSPAMrae.netwrote in message
news:%237xKnRMIIHA.5056@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
>"SAL" <SAL@.nospam.nospamwrote in message
>news:u5$G%23JMIIHA.4712@.TK2MSFTNGP04.phx.gbl...
>>
Quote:
Originally Posted by
>>My question is, is there some reason that my session variable evaporates
>>randomly?
>>
>No. Session variables will be lost when the Session times out, or when
>they are overwritten / removed - does either of these situations apply
>here...?
>>
>>
>--
>Mark Rae
>ASP.NET MVP
>http://www.markrae.net
>
>
Hi SAL,
Regarding difference between Response.Redirect and Server.Transfer, I think
following page is useful for your reference. Each approach has its own pros
and cons.
#Response.Redirect vs Server.Transfer
http://haacked.com/archive/2004/10/...rvertransfer.as
px
Back to the original issue about losing session after Redirect, I think
George's suggestion is quite helpful.
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Thank you for your reply and the article link.
I am currently investigating George's suggestion as well
S
""Walter Wang [MSFT]"" <wawang@.online.microsoft.comwrote in message
news:RatUSdeIIHA.4268@.TK2MSFTNGHUB02.phx.gbl...
Quote:
Originally Posted by
Hi SAL,
>
Regarding difference between Response.Redirect and Server.Transfer, I
think
following page is useful for your reference. Each approach has its own
pros
and cons.
>
#Response.Redirect vs Server.Transfer
http://haacked.com/archive/2004/10/...rvertransfer.as
px
>
Back to the original issue about losing session after Redirect, I think
George's suggestion is quite helpful.
>
>
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
>
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
"SAL" <SAL@.nospam.nospamwrote in
news:uFUwqXiIIHA.6108@.TK2MSFTNGP03.phx.gbl:
Quote:
Originally Posted by
Thank you for your reply and the article link.
I am currently investigating George's suggestion as well
Please post back here if (and when) you find the culprit.
I have stopped using sesion variables altogether becuase of
similar issues on a client's server, but am very interested
in what you figure out.
Now my client may well be changing the web.config file
which will cause the application to restart, all the more
reason to not use session varialbes (in my case).
Instead I pass info encrypted in the query string, which
works just fine, the only session variable I use is to
relay error messages to tan error page - if that gets
lost, oh well.
kpg
Hi SAL,
This looks like a normal shutdown, try to use following method to log the
cause and the time it occurs:
#Logging ASP.NET Application Shutdown Events - ScottGu's Blog
http://weblogs.asp.net/scottgu/arch.../14/433194.aspx
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi SAL,
How's the issue now?
Not directly related, but I think following information might be useful:
#Thomas Marquardt's Blog : ASP.NET File Change Notifications, exactly which
files and directories are monitored?
http://blogs.msdn.com/tmarq/archive...hange-notificat
ions-exactly-which-files-and-directories-are-monitored.aspx
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Okay, I did that. Now I'm getting this in the event log:
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be
found. The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer. You may be
able to use the /AUXSOURCE= flag to retrieve this description; see Help and
Support for details. The following information is part of the event:
_shutDownMessage=HostingEnvironment caused shutdown
_shutDownStack= at System.Environment.GetStackTrace(Exception e, Boolean
needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.HttpRuntime.ShutdownAppDomain()
at System.Web.Hosting.HostingEnvironment.ShutdownThis AppDomainOnce()
at
System.Web.Hosting.HostingEnvironment.InitiateShut downWorkItemCallback(Object
state)
at System.Threading.
Which I really don't understand. Help?
S
""Walter Wang [MSFT]"" <wawang@.online.microsoft.comwrote in message
news:OI6Y7QoIIHA.4200@.TK2MSFTNGHUB02.phx.gbl...
Quote:
Originally Posted by
Hi SAL,
>
This looks like a normal shutdown, try to use following method to log the
cause and the time it occurs:
>
#Logging ASP.NET Application Shutdown Events - ScottGu's Blog
http://weblogs.asp.net/scottgu/arch.../14/433194.aspx
>
>
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
>
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
Hi Walter. It's just as bad as ever and what I don't get is that, I'm not
changing anything when this stuff occurs that I'm aware of. All I'm doing is
redirecting to another page, changing DetailsView states to edit, cancelling
the edit, clicking another menu item and doing the same thing all over again
and it will restart which causes the ID of the item the viewer is using to
be lost in the session variable. And, since the ObjectDataSource is getting
records based on this ID, the app fails with a web page that isn't showing
any data.
S
""Walter Wang [MSFT]"" <wawang@.online.microsoft.comwrote in message
news:FRH$rDnJIHA.4200@.TK2MSFTNGHUB02.phx.gbl...
Quote:
Originally Posted by
Hi SAL,
>
How's the issue now?
>
Not directly related, but I think following information might be useful:
>
#Thomas Marquardt's Blog : ASP.NET File Change Notifications, exactly
which
files and directories are monitored?
http://blogs.msdn.com/tmarq/archive...hange-notificat
ions-exactly-which-files-and-directories-are-monitored.aspx
>
>
Regards,
Walter Wang (wawang@.online.microsoft.com, remove 'online.')
Microsoft Online Community Support
>
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
>
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
kpg,
what I figured out was the app was getting recycled due to a limit I had set
on virtual memory. There are times when the virtual memory usage jumps up
dramatically and then it pops right back down. The app does not appear to be
leaking memory at this time. So, I unchecked that option in the App pool's
configuration.
I used information garnered from this link to aid me in my quest, although I
haven't completely implemented Peter's Exception Engine.
http://www.eggheadcafe.com/articles/20030816.asp
I placed this code in my Application_Error routine in my Global.asax file:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
' check to see if the ASPNETApplication log exists
Dim b As Boolean
Try
b =
Convert.ToBoolean(ConfigurationManager.AppSettings ("logAppErrors"))
Catch ex As Exception
End Try
If Not b Then Exit Sub
If Not System.Diagnostics.EventLog. _
SourceExists("AnnexationTrackerApplication") Then
System.Diagnostics.EventLog. _
CreateEventSource("AnnexationTrackerApplication",
"Application")
End If
System.Diagnostics.EventLog. _
WriteEntry("AnnexationTrackerApplication",
Server.GetLastError().GetBaseException().Message)
End Sub
The message appeared in the system event log not the application event log.
HTH
S
"kpg*" <no@.spam.comwrote in message
news:Xns99E27E9E22F89ipostthereforeiam@.207.46.248. 16...
Quote:
Originally Posted by
"SAL" <SAL@.nospam.nospamwrote in
news:uFUwqXiIIHA.6108@.TK2MSFTNGP03.phx.gbl:
>
Quote:
Originally Posted by
>Thank you for your reply and the article link.
>I am currently investigating George's suggestion as well
>
Please post back here if (and when) you find the culprit.
>
I have stopped using sesion variables altogether becuase of
similar issues on a client's server, but am very interested
in what you figure out.
>
Now my client may well be changing the web.config file
which will cause the application to restart, all the more
reason to not use session varialbes (in my case).
>
Instead I pass info encrypted in the query string, which
works just fine, the only session variable I use is to
relay error messages to tan error page - if that gets
lost, oh well.
>
kpg
Tuesday, March 13, 2012
session variables are lost when logged into app first time
We migrated our Asp.net 1.1 application to Asp.net 2.0 ( just migration )
. It was working fine in local developer machine and one of our development
testing server.
When we moved to staging server which is also running on Windows 2000 server
and we started facing a peculiar issue.
We are able to login successfully every time , however , a click on a link
to move to a a different page on a hyper link.
<asp:HyperLink id="lnkClick" runat="server" ForeColor="Snow"
Font-Italic="True" Font-Size="Small"
Font-Underline="True" Font-Names="Arial" Target="_self"
Font-Bold="True">here</asp:HyperLink>
Code behind has the following code
lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")
What is the issue ?
When the new page is launched , it ends in null reference exception as the
session variables loaded in the previous page were lost.
Our session state is still inproc .
Is it due to any settings on the web server.
Any information is highly appreciated ."SM" <SM@.discussions.microsoft.com> wrote in message
news:A2CAF790-F6C1-4DF0-83E7-BA5975B6F979@.microsoft.com...
...
> Code behind has the following code
> lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")
Why do you need Convert.ToString?
> What is the issue ?
> When the new page is launched , it ends in null reference exception as the
> session variables loaded in the previous page were lost.
> Our session state is still inproc .
> Is it due to any settings on the web server.
I don't see any reason for your session state to be lost. Please show us why
you believe that your session state is being lost.
A simple test would be to place a Response.Write(Session["KEY"]) before the
place where you're getting the NullReferenceException. This would show
whether the exception is due to missing session state.
John
session variables are lost when logged into app first time
We migrated our Asp.net 1.1 application to Asp.net 2.0 ( just migration )
.. It was working fine in local developer machine and one of our development
testing server.
When we moved to staging server which is also running on windows 2000 server
and we started facing a peculiar issue.
We are able to login successfully every time , however , a click on a link
to move to a a different page on a hyper link.
<asp:HyperLink id="lnkClick" runat="server" ForeColor="Snow"
Font-Italic="True" Font-Size="Small"
Font-Underline="True" Font-Names="Arial" Target="_self"
Font-Bold="True">here</asp:HyperLink>
Code behind has the following code
lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")
What is the issue ?
When the new page is launched , it ends in null reference exception as the
session variables loaded in the previous page were lost.
Our session state is still inproc .
Is it due to any settings on the web server.
Any information is highly appreciated ."SM" <SM@.discussions.microsoft.comwrote in message
news:A2CAF790-F6C1-4DF0-83E7-BA5975B6F979@.microsoft.com...
...
Quote:
Originally Posted by
Code behind has the following code
lnkClick.NavigateUrl = Convert.ToString("Files12/Z_All_allReports.aspx")
Why do you need Convert.ToString?
Quote:
Originally Posted by
>
What is the issue ?
When the new page is launched , it ends in null reference exception as the
session variables loaded in the previous page were lost.
>
Our session state is still inproc .
Is it due to any settings on the web server.
I don't see any reason for your session state to be lost. Please show us why
you believe that your session state is being lost.
A simple test would be to place a Response.Write(Session["KEY"]) before the
place where you're getting the NullReferenceException. This would show
whether the exception is due to missing session state.
John
Session Variables getting cross threaded
I'm having a strange problem. I've got a .NET web app which uses Session
variables. Sometime, not all the time, they get cross threaded...that
is...one user will have another user's Session variable(s) data assigned to
them. I can't figure out why. I've read that other people are having this
problem too but I haven't found a resolution yet. Can someone please tell me
how I might go about fixing this?
ThanksHey Randy,
"Randy" <temp@.temp.com> wrote in message
news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
> Hello,
> I'm having a strange problem. I've got a .NET web app which uses Session
> variables. Sometime, not all the time, they get cross threaded...that
> is...one user will have another user's Session variable(s) data assigned
> to them. I can't figure out why. I've read that other people are having
> this problem too but I haven't found a resolution yet. Can someone please
> tell me how I might go about fixing this?
What's the environment? OS, IIS, etc...
Sorry, the app is using .NET v1.1.4322, the OS on the server is Server
2003...so I think the IIS version would be 6?
I'm wondering if it might be caused by using static variables?
Thanks for your help
"Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote in
message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> Hey Randy,
> "Randy" <temp@.temp.com> wrote in message
> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
>> Hello,
>> I'm having a strange problem. I've got a .NET web app which uses Session
>> variables. Sometime, not all the time, they get cross threaded...that
>> is...one user will have another user's Session variable(s) data assigned
>> to them. I can't figure out why. I've read that other people are having
>> this problem too but I haven't found a resolution yet. Can someone please
>> tell me how I might go about fixing this?
> What's the environment? OS, IIS, etc...
In particular...what is happening is...say two users are logged in. There is
a dropdown listbox which contains paypools. If the user changes paypools,
then the Session["paypool"] for that user is set to this. There are several
buttons on this page which go to different pages. One goes to a screen which
uses the Session["paypool"] object in a query (to Oracle) to populate this
new page. If both users click this button very close to the same time, the
second user will get the Session["paypool"] object of the other user.
"Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote in
message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> Hey Randy,
> "Randy" <temp@.temp.com> wrote in message
> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
>> Hello,
>> I'm having a strange problem. I've got a .NET web app which uses Session
>> variables. Sometime, not all the time, they get cross threaded...that
>> is...one user will have another user's Session variable(s) data assigned
>> to them. I can't figure out why. I've read that other people are having
>> this problem too but I haven't found a resolution yet. Can someone please
>> tell me how I might go about fixing this?
> What's the environment? OS, IIS, etc...
this is almost always a bug in the asp.net code. most likely you are storing
a reference to a session variable in vb module (shared). this is a no, no,
as vb module variables are shared across threads.
-- bruce (sqlwork.com)
"Randy" <temp@.temp.com> wrote in message
news:ewp90QcyFHA.3588@.tk2msftngp13.phx.gbl...
> In particular...what is happening is...say two users are logged in. There
> is a dropdown listbox which contains paypools. If the user changes
> paypools, then the Session["paypool"] for that user is set to this. There
> are several buttons on this page which go to different pages. One goes to
> a screen which uses the Session["paypool"] object in a query (to Oracle)
> to populate this new page. If both users click this button very close to
> the same time, the second user will get the Session["paypool"] object of
> the other user.
>
> "Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote in
> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>> Hey Randy,
>>
>> "Randy" <temp@.temp.com> wrote in message
>> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
>>> Hello,
>>> I'm having a strange problem. I've got a .NET web app which uses Session
>>> variables. Sometime, not all the time, they get cross threaded...that
>>> is...one user will have another user's Session variable(s) data assigned
>>> to them. I can't figure out why. I've read that other people are having
>>> this problem too but I haven't found a resolution yet. Can someone
>>> please tell me how I might go about fixing this?
>>
>> What's the environment? OS, IIS, etc...
>>
My app is in C#. I'm not very familiar with VB...the VB Module you're saying
is shared across threads? I didn't know that. But in my C# app, I'm not
sharing it that I'm aware of.
Thanks
"Bruce Barker" <brubar_nospamplease_@.safeco.com> wrote in message
news:%23U9VDgcyFHA.3408@.TK2MSFTNGP09.phx.gbl...
> this is almost always a bug in the asp.net code. most likely you are
> storing a reference to a session variable in vb module (shared). this is a
> no, no, as vb module variables are shared across threads.
> -- bruce (sqlwork.com)
>
> "Randy" <temp@.temp.com> wrote in message
> news:ewp90QcyFHA.3588@.tk2msftngp13.phx.gbl...
>> In particular...what is happening is...say two users are logged in. There
>> is a dropdown listbox which contains paypools. If the user changes
>> paypools, then the Session["paypool"] for that user is set to this. There
>> are several buttons on this page which go to different pages. One goes to
>> a screen which uses the Session["paypool"] object in a query (to Oracle)
>> to populate this new page. If both users click this button very close to
>> the same time, the second user will get the Session["paypool"] object of
>> the other user.
>>
>>
>> "Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote in
>> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>>> Hey Randy,
>>>
>>> "Randy" <temp@.temp.com> wrote in message
>>> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
>>>> Hello,
>>>> I'm having a strange problem. I've got a .NET web app which uses
>>>> Session variables. Sometime, not all the time, they get cross
>>>> threaded...that is...one user will have another user's Session
>>>> variable(s) data assigned to them. I can't figure out why. I've read
>>>> that other people are having this problem too but I haven't found a
>>>> resolution yet. Can someone please tell me how I might go about fixing
>>>> this?
>>>
>>> What's the environment? OS, IIS, etc...
>>>
>>
>>
Do you have static variables ? They are shared by the whole application
(i.e. all sessions using *the* application).
--
Patrice
"Randy" <temp@.temp.com> a crit dans le message de
news:OzXN1rcyFHA.3000@.TK2MSFTNGP12.phx.gbl...
> My app is in C#. I'm not very familiar with VB...the VB Module you're
saying
> is shared across threads? I didn't know that. But in my C# app, I'm not
> sharing it that I'm aware of.
> Thanks
>
> "Bruce Barker" <brubar_nospamplease_@.safeco.com> wrote in message
> news:%23U9VDgcyFHA.3408@.TK2MSFTNGP09.phx.gbl...
> > this is almost always a bug in the asp.net code. most likely you are
> > storing a reference to a session variable in vb module (shared). this is
a
> > no, no, as vb module variables are shared across threads.
> > -- bruce (sqlwork.com)
> > "Randy" <temp@.temp.com> wrote in message
> > news:ewp90QcyFHA.3588@.tk2msftngp13.phx.gbl...
> >> In particular...what is happening is...say two users are logged in.
There
> >> is a dropdown listbox which contains paypools. If the user changes
> >> paypools, then the Session["paypool"] for that user is set to this.
There
> >> are several buttons on this page which go to different pages. One goes
to
> >> a screen which uses the Session["paypool"] object in a query (to
Oracle)
> >> to populate this new page. If both users click this button very close
to
> >> the same time, the second user will get the Session["paypool"] object
of
> >> the other user.
> >>
> >>
> >> "Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote in
> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> >>> Hey Randy,
> >>>
> >>> "Randy" <temp@.temp.com> wrote in message
> >>> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
> >>>> Hello,
> >>>> I'm having a strange problem. I've got a .NET web app which uses
> >>>> Session variables. Sometime, not all the time, they get cross
> >>>> threaded...that is...one user will have another user's Session
> >>>> variable(s) data assigned to them. I can't figure out why. I've read
> >>>> that other people are having this problem too but I haven't found a
> >>>> resolution yet. Can someone please tell me how I might go about
fixing
> >>>> this?
> >>>
> >>> What's the environment? OS, IIS, etc...
> >>>
> >>
> >>
Yes, I do have static variables. I'm not using any of them (that I know of)
to assign a value directly to a Session variable, but use of static
variables sounds like that might be what is causing it? Should I not use any
static variables?
"Patrice" <nobody@.nowhere.com> wrote in message
news:OYhp6%23cyFHA.3856@.tk2msftngp13.phx.gbl...
> Do you have static variables ? They are shared by the whole application
> (i.e. all sessions using *the* application).
> --
> Patrice
> "Randy" <temp@.temp.com> a crit dans le message de
> news:OzXN1rcyFHA.3000@.TK2MSFTNGP12.phx.gbl...
>> My app is in C#. I'm not very familiar with VB...the VB Module you're
> saying
>> is shared across threads? I didn't know that. But in my C# app, I'm not
>> sharing it that I'm aware of.
>> Thanks
>>
>>
>> "Bruce Barker" <brubar_nospamplease_@.safeco.com> wrote in message
>> news:%23U9VDgcyFHA.3408@.TK2MSFTNGP09.phx.gbl...
>> > this is almost always a bug in the asp.net code. most likely you are
>> > storing a reference to a session variable in vb module (shared). this
>> > is
> a
>> > no, no, as vb module variables are shared across threads.
>>> > -- bruce (sqlwork.com)
>>>> > "Randy" <temp@.temp.com> wrote in message
>> > news:ewp90QcyFHA.3588@.tk2msftngp13.phx.gbl...
>> >> In particular...what is happening is...say two users are logged in.
> There
>> >> is a dropdown listbox which contains paypools. If the user changes
>> >> paypools, then the Session["paypool"] for that user is set to this.
> There
>> >> are several buttons on this page which go to different pages. One goes
> to
>> >> a screen which uses the Session["paypool"] object in a query (to
> Oracle)
>> >> to populate this new page. If both users click this button very close
> to
>> >> the same time, the second user will get the Session["paypool"] object
> of
>> >> the other user.
>> >>
>> >>
>> >> "Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote in
>> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>> >>> Hey Randy,
>> >>>
>> >>> "Randy" <temp@.temp.com> wrote in message
>> >>> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
>> >>>> Hello,
>> >>>> I'm having a strange problem. I've got a .NET web app which uses
>> >>>> Session variables. Sometime, not all the time, they get cross
>> >>>> threaded...that is...one user will have another user's Session
>> >>>> variable(s) data assigned to them. I can't figure out why. I've read
>> >>>> that other people are having this problem too but I haven't found a
>> >>>> resolution yet. Can someone please tell me how I might go about
> fixing
>> >>>> this?
>> >>>
>> >>> What's the environment? OS, IIS, etc...
>> >>>
>> >>
>> >>
>>>>
>>
Do you affect a session value to such a variable ?
Those variables have an application wide scope. In the case of ASP.NET, it
means they are shared accross all sessions. So you 'll usually won't want
them in an ASP.NET application.
(using a shared property that return the value from the session variable
would work and could be a quick way to fix this problem).
--
Patrice
"Randy" <temp@.temp.com> a crit dans le message de
news:OrwZuIdyFHA.1168@.TK2MSFTNGP10.phx.gbl...
> Yes, I do have static variables. I'm not using any of them (that I know
of)
> to assign a value directly to a Session variable, but use of static
> variables sounds like that might be what is causing it? Should I not use
any
> static variables?
>
> "Patrice" <nobody@.nowhere.com> wrote in message
> news:OYhp6%23cyFHA.3856@.tk2msftngp13.phx.gbl...
> > Do you have static variables ? They are shared by the whole application
> > (i.e. all sessions using *the* application).
> > --
> > Patrice
> > "Randy" <temp@.temp.com> a crit dans le message de
> > news:OzXN1rcyFHA.3000@.TK2MSFTNGP12.phx.gbl...
> >> My app is in C#. I'm not very familiar with VB...the VB Module you're
> > saying
> >> is shared across threads? I didn't know that. But in my C# app, I'm not
> >> sharing it that I'm aware of.
> >> Thanks
> >>
> >>
> >> "Bruce Barker" <brubar_nospamplease_@.safeco.com> wrote in message
> >> news:%23U9VDgcyFHA.3408@.TK2MSFTNGP09.phx.gbl...
> >> > this is almost always a bug in the asp.net code. most likely you are
> >> > storing a reference to a session variable in vb module (shared). this
> >> > is
> > a
> >> > no, no, as vb module variables are shared across threads.
> >> >> > -- bruce (sqlwork.com)
> >> >> >> > "Randy" <temp@.temp.com> wrote in message
> >> > news:ewp90QcyFHA.3588@.tk2msftngp13.phx.gbl...
> >> >> In particular...what is happening is...say two users are logged in.
> > There
> >> >> is a dropdown listbox which contains paypools. If the user changes
> >> >> paypools, then the Session["paypool"] for that user is set to this.
> > There
> >> >> are several buttons on this page which go to different pages. One
goes
> > to
> >> >> a screen which uses the Session["paypool"] object in a query (to
> > Oracle)
> >> >> to populate this new page. If both users click this button very
close
> > to
> >> >> the same time, the second user will get the Session["paypool"]
object
> > of
> >> >> the other user.
> >> >>
> >> >>
> >> >> "Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote
in
> >> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
> >> >>> Hey Randy,
> >> >>>
> >> >>> "Randy" <temp@.temp.com> wrote in message
> >> >>> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
> >> >>>> Hello,
> >> >>>> I'm having a strange problem. I've got a .NET web app which uses
> >> >>>> Session variables. Sometime, not all the time, they get cross
> >> >>>> threaded...that is...one user will have another user's Session
> >> >>>> variable(s) data assigned to them. I can't figure out why. I've
read
> >> >>>> that other people are having this problem too but I haven't found
a
> >> >>>> resolution yet. Can someone please tell me how I might go about
> > fixing
> >> >>>> this?
> >> >>>
> >> >>> What's the environment? OS, IIS, etc...
> >> >>>
> >> >>
> >> >>
> >> >> >>
> >>
I was using a static in the screen (aspx file) where the anomaly was
occuring. I took out the static and slightly recoded and I believe it fixed
it! I can't seem to reproduce the anomaly. I'll keep testing, but I really
appreciate everyones help!
I'll never use static in an ASP app again :)
Thanks!
"Patrice" <nobody@.nowhere.com> wrote in message
news:OJInWYdyFHA.2644@.TK2MSFTNGP09.phx.gbl...
> Do you affect a session value to such a variable ?
> Those variables have an application wide scope. In the case of ASP.NET, it
> means they are shared accross all sessions. So you 'll usually won't want
> them in an ASP.NET application.
> (using a shared property that return the value from the session variable
> would work and could be a quick way to fix this problem).
> --
> Patrice
> "Randy" <temp@.temp.com> a crit dans le message de
> news:OrwZuIdyFHA.1168@.TK2MSFTNGP10.phx.gbl...
>> Yes, I do have static variables. I'm not using any of them (that I know
> of)
>> to assign a value directly to a Session variable, but use of static
>> variables sounds like that might be what is causing it? Should I not use
> any
>> static variables?
>>
>>
>> "Patrice" <nobody@.nowhere.com> wrote in message
>> news:OYhp6%23cyFHA.3856@.tk2msftngp13.phx.gbl...
>> > Do you have static variables ? They are shared by the whole application
>> > (i.e. all sessions using *the* application).
>>> > --
>> > Patrice
>>> > "Randy" <temp@.temp.com> a crit dans le message de
>> > news:OzXN1rcyFHA.3000@.TK2MSFTNGP12.phx.gbl...
>> >> My app is in C#. I'm not very familiar with VB...the VB Module you're
>> > saying
>> >> is shared across threads? I didn't know that. But in my C# app, I'm
>> >> not
>> >> sharing it that I'm aware of.
>> >> Thanks
>> >>
>> >>
>> >> "Bruce Barker" <brubar_nospamplease_@.safeco.com> wrote in message
>> >> news:%23U9VDgcyFHA.3408@.TK2MSFTNGP09.phx.gbl...
>> >> > this is almost always a bug in the asp.net code. most likely you are
>> >> > storing a reference to a session variable in vb module (shared).
>> >> > this
>> >> > is
>> > a
>> >> > no, no, as vb module variables are shared across threads.
>> >>> >> > -- bruce (sqlwork.com)
>> >>> >>> >> > "Randy" <temp@.temp.com> wrote in message
>> >> > news:ewp90QcyFHA.3588@.tk2msftngp13.phx.gbl...
>> >> >> In particular...what is happening is...say two users are logged in.
>> > There
>> >> >> is a dropdown listbox which contains paypools. If the user changes
>> >> >> paypools, then the Session["paypool"] for that user is set to this.
>> > There
>> >> >> are several buttons on this page which go to different pages. One
> goes
>> > to
>> >> >> a screen which uses the Session["paypool"] object in a query (to
>> > Oracle)
>> >> >> to populate this new page. If both users click this button very
> close
>> > to
>> >> >> the same time, the second user will get the Session["paypool"]
> object
>> > of
>> >> >> the other user.
>> >> >>
>> >> >>
>> >> >> "Christoph Wienands" <christoph.wienands@.siemens.remove.com> wrote
> in
>> >> >> message news:%235WsR4byFHA.3892@.TK2MSFTNGP12.phx.gbl...
>> >> >>> Hey Randy,
>> >> >>>
>> >> >>> "Randy" <temp@.temp.com> wrote in message
>> >> >>> news:O54H7QbyFHA.736@.tk2msftngp13.phx.gbl...
>> >> >>>> Hello,
>> >> >>>> I'm having a strange problem. I've got a .NET web app which uses
>> >> >>>> Session variables. Sometime, not all the time, they get cross
>> >> >>>> threaded...that is...one user will have another user's Session
>> >> >>>> variable(s) data assigned to them. I can't figure out why. I've
> read
>> >> >>>> that other people are having this problem too but I haven't found
> a
>> >> >>>> resolution yet. Can someone please tell me how I might go about
>> > fixing
>> >> >>>> this?
>> >> >>>
>> >> >>> What's the environment? OS, IIS, etc...
>> >> >>>
>> >> >>
>> >> >>
>> >>> >>> >>
>> >>
>>>>
>>