Saturday, March 31, 2012
Session Timeout, not working
the web.config(120 minutes for testing) after 20 minutes to 30 minutes
click a button and am redirected back to the login. My Session is
reporting 120 minutes I know this becuase I display on a debug page.
below are the 2 areas in the web.config that I set anybody tell me
whats wrong or what is missing.
<sessionState mode="InProc" regenerateExpiredSessionId="false"
timeout="120">
</sessionState>
<forms name=".GSNAUTH" loginUrl="Login.aspx" path="/"
protection="Encryption" timeout="120" slidingExpiration="true"/>
When previeing on the page I see the top 1 becuase I have been able
to adjust it down to 60 minutes or 35 minutes whatever.
When I display on the debug page I show
lblSessionTimeout.text = Session.Timeout;
NOt sure what I am missing."Scott" <sremiger@.groceryshopping.net> wrote in message
news:47b0bb72-a003-4f59-9e19-fb5cbe61e720@.o77g2000hsf.googlegroups.com...
> I have set the session timeout something greater then 20 minutes in
> the web.config(120 minutes for testing) after 20 minutes to 30 minutes
> click a button and am redirected back to the login. My Session is
> reporting 120 minutes I know this becuase I display on a debug page.
> below are the 2 areas in the web.config that I set anybody tell me
> whats wrong or what is missing.
> <sessionState mode="InProc" regenerateExpiredSessionId="false"
> timeout="120">
> </sessionState>
> <forms name=".GSNAUTH" loginUrl="Login.aspx" path="/"
> protection="Encryption" timeout="120" slidingExpiration="true"/>
> When previeing on the page I see the top 1 becuase I have been able
> to adjust it down to 60 minutes or 35 minutes whatever.
> When I display on the debug page I show
> lblSessionTimeout.text = Session.Timeout;
> NOt sure what I am missing.
Unless you have other clients creating activity on the site your Application
Pool is probably timing out. When a pool has seen absolutely no activity
whatsoever it can shutdown. Check the settings on the pool to which your
application belongs.
Anthony Jones - MVP ASP/ASP.NET
Session expiration and forms authentication timeouts are two separate and
distinct things. Being redirected to a login page is a forms authentication
timeout issue, unless somehow you are also using session to do this.
Your ASP.NET application can recycle for any number of reasons, and when it
does, all inProc Sessions go bye-bye.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: htp://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"Scott" wrote:
> I have set the session timeout something greater then 20 minutes in
> the web.config(120 minutes for testing) after 20 minutes to 30 minutes
> click a button and am redirected back to the login. My Session is
> reporting 120 minutes I know this becuase I display on a debug page.
> below are the 2 areas in the web.config that I set anybody tell me
> whats wrong or what is missing.
> <sessionState mode="InProc" regenerateExpiredSessionId="false"
> timeout="120">
> </sessionState>
> <forms name=".GSNAUTH" loginUrl="Login.aspx" path="/"
> protection="Encryption" timeout="120" slidingExpiration="true"/>
> When previeing on the page I see the top 1 becuase I have been able
> to adjust it down to 60 minutes or 35 minutes whatever.
> When I display on the debug page I show
> lblSessionTimeout.text = Session.Timeout;
> NOt sure what I am missing.
>
Session times out too soon...
My web.config session setting is timeout=20, but in code we set the timeout
to override this to some user preference, often 40 minutes, (specified by
the user in seconds). But even in fairly active sessions, (ones where post
are done every 5 minutes or less), we still have session timing out.
Whether either the 20 minute or 40 minute value is in effect, I never wait
more than 5 minutes between posts back to the server (doing real work) so I
would NOT expect a session timeout.
Does anybody have any ideas about how to track this down? Are others having
similar results? Do I need to provide more data to make sense?
Thanks in advance for your time. I've been in software for 20+ years, but
new to ASP.NET. Our actual ASP.NET developers are baffled too.
Thanks! Sincerely,
James Hunter Ross
Senior Software Developer
O'Neil Software, Inc.
james.ross@dotnet.itags.org.oneilsoft.comJames Hunter Ross wrote:
> Friends,
> My web.config session setting is timeout=20, but in code we set the
> timeout to override this to some user preference, often 40 minutes,
> (specified by the user in seconds). But even in fairly active
> sessions, (ones where post are done every 5 minutes or less), we
> still have session timing out. Whether either the 20 minute or 40
> minute value is in effect, I never wait more than 5 minutes between
> posts back to the server (doing real work) so I would NOT expect a
> session timeout.
If you really are seeing Session loss (instead of something else that only
looks like Session loss), the most common cause would be an app domain
restart, assuming you are using InProc Session state.
Check the ASP.NET v1.1.4322 object in perfmon. There is a counter for
Application Restarts. Monitor that when you lose Session. If it increments
at the same time, your app domain recycling is causing the problem.
The most common cause of app domain restarts is file change notifications.
That would be caused by anti-virus or something else scanning the
application or from someone changing the web.config in the root folder or
something in the bin.
--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com
FrontPage add-ins for FrontPage 2000 - 2003
I also experienced this issue and found Jim's post regarding
sessionState mode to be helpful.
I changed my sessionState mode from the default inproc to StateServer.
Of course, this is one of those situations where, after the change, I'm
waiting for the application to, uh, NOT break. But so far so good.
One question I had for Jim is about perfmon. This looks like a really
neat tool - I just wish I knew how to use it.
When you say to 'Check the ASP.NET v1.1.4322 object in perfmon' - how
does one do that?
Cheers,
Robert Meyer
ISG
http://www.isgcom.com
*** Sent via Developersdex http://www.developersdex.com ***
Robert Meyer wrote:
> When you say to 'Check the ASP.NET v1.1.4322 object in perfmon' - how
> does one do that?
Hi Robert,
Perfmon (Performance) is in Administrative Tools. When you launch it,
choose "ASP.NET v1.1.4322" from the object dropdown. That will populate the
Counter and Instance listboxes. Choose "Application Restarts" from the
Counter listbox and then choose your process (or Global) from the instance
listbox. Then click Add and then Close.
Now you will have an item in the listbox at the bottom of Perfmon for
Application Restarts. If you select it, you'll see a graph representation
and numeric values for that counter. If you see that increment when your
problem occurs, you'll know it was because of an app domain restart.
--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com
Session times out too soon...
My web.config session setting is timeout=20, but in code we set the timeout
to override this to some user preference, often 40 minutes, (specified by
the user in seconds). But even in fairly active sessions, (ones where post
are done every 5 minutes or less), we still have session timing out.
Whether either the 20 minute or 40 minute value is in effect, I never wait
more than 5 minutes between posts back to the server (doing real work) so I
would NOT expect a session timeout.
Does anybody have any ideas about how to track this down? Are others having
similar results? Do I need to provide more data to make sense?
Thanks in advance for your time. I've been in software for 20+ years, but
new to ASP.NET. Our actual ASP.NET developers are baffled too.
Thanks! Sincerely,
James Hunter Ross
Senior Software Developer
O'Neil Software, Inc.
james.ross@dotnet.itags.org.oneilsoft.comJames Hunter Ross wrote:
> Friends,
> My web.config session setting is timeout=20, but in code we set the
> timeout to override this to some user preference, often 40 minutes,
> (specified by the user in seconds). But even in fairly active
> sessions, (ones where post are done every 5 minutes or less), we
> still have session timing out. Whether either the 20 minute or 40
> minute value is in effect, I never wait more than 5 minutes between
> posts back to the server (doing real work) so I would NOT expect a
> session timeout.
If you really are seeing Session loss (instead of something else that only
looks like Session loss), the most common cause would be an app domain
restart, assuming you are using InProc Session state.
Check the ASP.NET v1.1.4322 object in perfmon. There is a counter for
Application Restarts. Monitor that when you lose Session. If it increments
at the same time, your app domain recycling is causing the problem.
The most common cause of app domain restarts is file change notifications.
That would be caused by anti-virus or something else scanning the
application or from someone changing the web.config in the root folder or
something in the bin.
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com
FrontPage add-ins for FrontPage 2000 - 2003
I also experienced this issue and found Jim's post regarding
sessionState mode to be helpful.
I changed my sessionState mode from the default inproc to StateServer.
Of course, this is one of those situations where, after the change, I'm
waiting for the application to, uh, NOT break. But so far so good.
One question I had for Jim is about perfmon. This looks like a really
neat tool - I just wish I knew how to use it.
When you say to 'Check the ASP.NET v1.1.4322 object in perfmon' - how
does one do that?
Cheers,
Robert Meyer
ISG
http://www.isgcom.com
*** Sent via Developersdex http://www.examnotes.net ***
Robert Meyer wrote:
> When you say to 'Check the ASP.NET v1.1.4322 object in perfmon' - how
> does one do that?
>
Hi Robert,
Perfmon (Performance) is in Administrative Tools. When you launch it,
choose "ASP.NET v1.1.4322" from the object dropdown. That will populate the
Counter and Instance listboxes. Choose "Application Restarts" from the
Counter listbox and then choose your process (or Global) from the instance
listbox. Then click Add and then Close.
Now you will have an item in the listbox at the bottom of Perfmon for
Application Restarts. If you select it, you'll see a graph representation
and numeric values for that counter. If you see that increment when your
problem occurs, you'll know it was because of an app domain restart.
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com
Session timing problem
I add an object to session (Session.Add()) and set the session timeout in the web.config for 20 minutes however it seems to lose the session after 5 minutes (well before 20 minutes) or after a few refreshes of the page.
any ideas how I can keep the session alive for longer fully until the time specified in the web.config?Might be a problem with the ASP.NET worker process. Check your Event Viewer first to see if W3WP or any related processes have errored out, which may be causing the worker process to recycle (therefore ending the session)
i doubt that is the issue as the same problem happens when i upload it to my web hosting server. :)
Session tracked via URL in ASP.NET
I have my asp.net web application to track session id across pages using the url, and not cookies, ie in the web.config file:
<sessionState .... cookieless="true" ...... />
however each link in the page does not embed the id in the url like it is supposed to :
<a href="http://links.10026.com/?link=http://mywebserver/(rqe4ptb333ojxz3kh1t3xqr3)/mypage.aspx"> my link </a>
and so each page i travel to, a new session id is created in the url and the information associated with the previous page's session id is lost.
can anybody tell me what else i need to do to make this work?
thank you,
Kenton Taylorfor some reason the .net framework will not insert the session id before rendering the HTML if your HREF uses a "/" to denote that the path is relative to the root
this will work:
href="http://myserver/home.aspx"
as will this:
href="home.aspx"
but this won't:
href="/home.aspx"
session uniqueid
ThanksEach session has a session ID. Use Session.SessionID to get it. This id is, however, not unique all the time.
Session unavailable in PostAcquireRequestState/PreRequestHandlerExecute
has a fix.
I've got a .Net 2.0 web service for which I need session state, I can't
use cookies because I'm using the .NetCF, I used a cookieless session
and that was fine over Wi-Fi but borked horribly over GPRS, for which I
blame the ISP.
I implemented a quick hack with a SoapHeader containing the SessionId
and implemented a custom ISessionIDManager, now I just want to get some
data back out.
For reasons I'm unable to fathom, HttpContext.Session is unavailable
during PreRequestHandlerExecute. Even more bizarrely, the session is
unavailable during PostAcquireRequestState, the event that fires to
tell you that the session has been populated.
This issue affects .asmx and .axd files, but NOT aspx. The issue has
been raised before in posts going back (at least) to 2002 under the 1.0
framework.
The WebMethods involved all have EnableSession set to true and I can
access the session from the actual webservice, just not from any
application events that fire beforehand.
Does anybody have a workaround for this? I suppose I could drop the
session altogether and use the Application Cache to store a user's
credentials, but that's uglier than ugliness.
<code
public class AuthenticateRequestHttpModule : IHttpModule
{
private HttpApplication _HttpApp;
public void Init(HttpApplication httpApp)
{
this._HttpApp = httpApp;
_HttpApp.PostAcquireRequestState+= new
EventHandler(AuthenticateFromSession);
}
protected void AuthenticateFromSession(object sender, EventArgs
e)
{
HttpContext context = (sender as HttpApplication).Context;
if(null == context.Session)
throw new Exception("Isn't this a _really_ silly bug?");
}
public void Dispose(){}
}
</codeAdded the IRequiresSessionState marker interface. For some reason,
this seems to be required for non-aspx files in HttpModules, though it
worked without if I was access a web page.
I'd tried this before, but must have been handling an event too early
in the request lifecycle.
Session unavailable in PostAcquireRequestState/PreRequestHandlerExecute
has a fix.
I've got a .Net 2.0 web service for which I need session state, I can't
use cookies because I'm using the .NetCF, I used a cookieless session
and that was fine over Wi-Fi but borked horribly over GPRS, for which I
blame the ISP.
I implemented a quick hack with a SoapHeader containing the SessionId
and implemented a custom ISessionIDManager, now I just want to get some
data back out.
For reasons I'm unable to fathom, HttpContext.Session is unavailable
during PreRequestHandlerExecute. Even more bizarrely, the session is
unavailable during PostAcquireRequestState, the event that fires to
tell you that the session has been populated.
This issue affects .asmx and .axd files, but NOT aspx. The issue has
been raised before in posts going back (at least) to 2002 under the 1.0
framework.
The WebMethods involved all have EnableSession set to true and I can
access the session from the actual webservice, just not from any
application events that fire beforehand.
Does anybody have a workaround for this? I suppose I could drop the
session altogether and use the Application Cache to store a user's
credentials, but that's uglier than ugliness.
<code>
public class AuthenticateRequestHttpModule : IHttpModule
{
private HttpApplication _HttpApp;
public void Init(HttpApplication httpApp)
{
this._HttpApp = httpApp;
_HttpApp.PostAcquireRequestState+= new
EventHandler(AuthenticateFromSession);
}
protected void AuthenticateFromSession(object sender, EventArgs
e)
{
HttpContext context = (sender as HttpApplication).Context;
if(null == context.Session)
throw new Exception("Isn't this a _really_ silly bug?");
}
public void Dispose(){}
}
</code>Added the IRequiresSessionState marker interface. For some reason,
this seems to be required for non-aspx files in HttpModules, though it
worked without if I was access a web page.
I'd tried this before, but must have been handling an event too early
in the request lifecycle.
session vaiables lost randomly
Anybody have an idea why the session variables are randomly lost ?
thanks, rich"i am developing an asp.net web based application using javascript as the
server side scripting language"
is this possible? What are you using to develope this? Better yet, why are
you using javascript as a serverside .NET language?
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"rich00" <rich00@.discussions.microsoft.com> wrote in message
news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
> i am developing an asp.net web based application using javascript as the
server side scripting language. The application makes constant use of an
access database and session variables. in a random way, the session
variables are lost causing the application to break. The only software on
the xp-pro box is iis, .NET framework, office 2003 and 3 com objects:
aspmail, aspimage and aspsmartupload. There is no virus detection software.
> Anybody have an idea why the session variables are randomly lost ?
> thanks, rich
this application is a port from asp to asp.net
asp only suppoted basic or javascript. the choice of javacript over basic was easy.
"rich00" wrote:
> i am developing an asp.net web based application using javascript as the server side scripting language. The application makes constant use of an access database and session variables. in a random way, the session variables are lost causing the application to break. The only software on the xp-pro box is iis, .NET framework, office 2003 and 3 com objects: aspmail, aspimage and aspsmartupload. There is no virus detection software.
> Anybody have an idea why the session variables are randomly lost ?
> thanks, rich
jscript.net is a fine language, it only downside is lack of ide support.
anyway, lots of events trigger loss of session. any recompile of the app or
reload of the domain, cause session data to be lost with the inproc session
manager. check the event log form appdomain recycles.
if you want a stable site, you should not use inproc, but the sql session
manager (works with the free msde).
-- bruce (sqlwork.com)
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:uA6taC$TEHA.3012@.tk2msftngp13.phx.gbl...
> "i am developing an asp.net web based application using javascript as the
> server side scripting language"
> is this possible? What are you using to develope this? Better yet, why are
> you using javascript as a serverside .NET language?
> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> Site: http://www.Darkfalz.com
> Blog: http://blog.Darkfalz.com
>
> "rich00" <rich00@.discussions.microsoft.com> wrote in message
> news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
> > i am developing an asp.net web based application using javascript as the
> server side scripting language. The application makes constant use of an
> access database and session variables. in a random way, the session
> variables are lost causing the application to break. The only software on
> the xp-pro box is iis, .NET framework, office 2003 and 3 com objects:
> aspmail, aspimage and aspsmartupload. There is no virus detection
software.
> > Anybody have an idea why the session variables are randomly lost ?
> > thanks, rich
>i am developing an asp.net web based application using javascript as the
>server side scripting language
wow, can i see that code please.
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"rich00" <rich00@.discussions.microsoft.com> wrote in message
news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
>i am developing an asp.net web based application using javascript as the
>server side scripting language. The application makes constant use of an
>access database and session variables. in a random way, the session
>variables are lost causing the application to break. The only software on
>the xp-pro box is iis, .NET framework, office 2003 and 3 com objects:
>aspmail, aspimage and aspsmartupload. There is no virus detection software.
> Anybody have an idea why the session variables are randomly lost ?
> thanks, rich
the app consists of 1000+ scripts. i can send you a smple sctipt or 2. the app builds database driven web sites.
"Alvin Bruney [MVP]" wrote:
> >i am developing an asp.net web based application using javascript as the
> >server side scripting language
> wow, can i see that code please.
> --
> Regards,
> Alvin Bruney
> [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
> Got tidbits? Get it here... http://tinyurl.com/27cok
> "rich00" <rich00@.discussions.microsoft.com> wrote in message
> news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
> >i am developing an asp.net web based application using javascript as the
> >server side scripting language. The application makes constant use of an
> >access database and session variables. in a random way, the session
> >variables are lost causing the application to break. The only software on
> >the xp-pro box is iis, .NET framework, office 2003 and 3 com objects:
> >aspmail, aspimage and aspsmartupload. There is no virus detection software.
> > Anybody have an idea why the session variables are randomly lost ?
> > thanks, rich
>
session vaiables lost randomly
ver side scripting language. The application makes constant use of an access
database and session variables. in a random way, the session variables are
lost causing the applicatio
n to break. The only software on the xp-pro box is iis, .NET framework, offi
ce 2003 and 3 com objects: aspmail, aspimage and aspsmartupload. There is no
virus detection software.
Anybody have an idea why the session variables are randomly lost ?
thanks, rich"i am developing an asp.net web based application using javascript as the
server side scripting language"
is this possible? What are you using to develope this? Better yet, why are
you using javascript as a serverside .NET language?
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"rich00" <rich00@.discussions.microsoft.com> wrote in message
news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
> i am developing an asp.net web based application using javascript as the
server side scripting language. The application makes constant use of an
access database and session variables. in a random way, the session
variables are lost causing the application to break. The only software on
the xp-pro box is iis, .NET framework, office 2003 and 3 com objects:
aspmail, aspimage and aspsmartupload. There is no virus detection software.
> Anybody have an idea why the session variables are randomly lost ?
> thanks, rich
this application is a port from asp to asp.net
asp only suppoted basic or javascript. the choice of javacript over basic wa
s easy.
"rich00" wrote:
> i am developing an asp.net web based application using javascript as the server si
de scripting language. The application makes constant use of an access database and
session variables. in a random way, the session variables are lost causing the appli
cat
ion to break. The only software on the xp-pro box is iis, .NET framework, office 2003 and 3
com objects: aspmail, aspimage and aspsmartupload. There is no virus detection software.[c
olor=darkred]
> Anybody have an idea why the session variables are randomly lost ?
> thanks, rich[/color]
jscript.net is a fine language, it only downside is lack of ide support.
anyway, lots of events trigger loss of session. any recompile of the app or
reload of the domain, cause session data to be lost with the inproc session
manager. check the event log form appdomain recycles.
if you want a stable site, you should not use inproc, but the sql session
manager (works with the free msde).
-- bruce (sqlwork.com)
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:uA6taC$TEHA.3012@.tk2msftngp13.phx.gbl...
> "i am developing an asp.net web based application using javascript as the
> server side scripting language"
> is this possible? What are you using to develope this? Better yet, why are
> you using javascript as a serverside .NET language?
> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> Site: http://www.Darkfalz.com
> Blog: http://blog.Darkfalz.com
>
> "rich00" <rich00@.discussions.microsoft.com> wrote in message
> news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
> server side scripting language. The application makes constant use of an
> access database and session variables. in a random way, the session
> variables are lost causing the application to break. The only software on
> the xp-pro box is iis, .NET framework, office 2003 and 3 com objects:
> aspmail, aspimage and aspsmartupload. There is no virus detection
software.
>
>i am developing an asp.net web based application using javascript as the
>server side scripting language
wow, can i see that code please.
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"rich00" <rich00@.discussions.microsoft.com> wrote in message
news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
>i am developing an asp.net web based application using javascript as the
>server side scripting language. The application makes constant use of an
>access database and session variables. in a random way, the session
>variables are lost causing the application to break. The only software on
>the xp-pro box is iis, .NET framework, office 2003 and 3 com objects:
>aspmail, aspimage and aspsmartupload. There is no virus detection software.
> Anybody have an idea why the session variables are randomly lost ?
> thanks, rich
the app consists of 1000+ scripts. i can send you a smple sctipt or 2. the a
pp builds database driven web sites.
"Alvin Bruney [MVP]" wrote:
> wow, can i see that code please.
> --
> Regards,
> Alvin Bruney
> [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
> Got tidbits? Get it here... http://tinyurl.com/27cok
> "rich00" <rich00@.discussions.microsoft.com> wrote in message
> news:C0B5DB69-E5F5-4946-917A-CBE4ED71325B@.microsoft.com...
>
>
Session URL Formatting
I have a problem with ASP.Net:
I have an ASP.Net application on a web farm, using SQL Server Session
State Management, running on Windows 2000 (IIS 5)
With session management on, a URL like the following is created:
https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx
The problem I am having is that at some point within the web application
I have to pass this link to an outside server, which in turn,
will do some work and then post back to my application. However, the
outside application is URL Encoding my URL, which in turn,
causes the URL to look like:
mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
This cannot be handled by IIS, and induces a "page cannot be displayed
error"; which in effect, causes the application to terminate.
Is there any way that we can trap this error and redirect to the appropriate
location so that the web application does terminate, or is there a way
we can prevent the brackets within this application.
Hope I explained this correctly.
Appreciate any help.
Regards,
Malcolm KlotzOne approach - not clean - you can catch the IIS error code 404 and then
handle the issue on a redirect page. Sorry, I can't think of anything
cleaner at the moment.
--
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Malcolm Klotz" <nonesuch23@.online.nospam> wrote in message
news:OvlaLxATFHA.2812@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I have a problem with ASP.Net:
> I have an ASP.Net application on a web farm, using SQL Server Session
> State Management, running on Windows 2000 (IIS 5)
> With session management on, a URL like the following is created:
> https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx
> The problem I am having is that at some point within the web
> application
> I have to pass this link to an outside server, which in turn,
> will do some work and then post back to my application. However, the
> outside application is URL Encoding my URL, which in turn,
> causes the URL to look like:
> mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
> This cannot be handled by IIS, and induces a "page cannot be displayed
> error"; which in effect, causes the application to terminate.
> Is there any way that we can trap this error and redirect to the
> appropriate
> location so that the web application does terminate, or is there a way
> we can prevent the brackets within this application.
> Hope I explained this correctly.
> Appreciate any help.
> Regards,
> Malcolm Klotz
Thanks for Alvin's inputs,
Hi Malcolm,
Since you are using the cookieless Session(embed sessionid in the url
string) in your web app, is there any particular requirement in your
scenario that we must use cookieless session? Is it possbile that we use
cookieenabled session instread?
Also, as for passing the url to a outside server, I think we have the
following means:
1. If we are forced to use cookieless session and with the sessionid
embeded in the url, I suggest that we filter the sessionid when pass the
url out to the remote server. For example:
when giving the following url
https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx
we can use substring concating or regex to get the url without embeded
sessionid like:
https://mywebapp.com/start.aspx
this can also work for the remote requster, the only difference is that the
request with non-sessionid url will be unable to retrieve the data in the
SessionState associated with the id. Do you think this means possbile?
2. If we also want to let the remote server be able to retrieve the
sessiondata, I suggest that we still pass the urlstring without embeded
sessionid , but also pass the SessionId string as separate data to that
remote server together with the url string. How do you think of this?
Please feel free to post here if you have any other questions or ideas.
Thanks,
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thank you, you have given me a place to start.
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:eSJz3kGTFHA.2476@.TK2MSFTNGXA01.phx.gbl...
> Thanks for Alvin's inputs,
> Hi Malcolm,
> Since you are using the cookieless Session(embed sessionid in the url
> string) in your web app, is there any particular requirement in your
> scenario that we must use cookieless session? Is it possbile that we use
> cookieenabled session instread?
> Also, as for passing the url to a outside server, I think we have the
> following means:
> 1. If we are forced to use cookieless session and with the sessionid
> embeded in the url, I suggest that we filter the sessionid when pass the
> url out to the remote server. For example:
> when giving the following url
> https://mywebapp.com/(ts2t2uivrj3vx...cvg)/start.aspx
> we can use substring concating or regex to get the url without embeded
> sessionid like:
> https://mywebapp.com/start.aspx
> this can also work for the remote requster, the only difference is that
the
> request with non-sessionid url will be unable to retrieve the data in the
> SessionState associated with the id. Do you think this means possbile?
> 2. If we also want to let the remote server be able to retrieve the
> sessiondata, I suggest that we still pass the urlstring without embeded
> sessionid , but also pass the SessionId string as separate data to that
> remote server together with the url string. How do you think of this?
> Please feel free to post here if you have any other questions or ideas.
> Thanks,
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
You're welcome Malcolm,
Good luck! :-)
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thursday, March 29, 2012
Session URL Formatting
I have a problem with ASP.Net:
I have an ASP.Net application on a web farm, using SQL Server Session
State Management, running on Windows 2000 (IIS 5)
With session management on, a URL like the following is created:
https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
The problem I am having is that at some point within the web application
I have to pass this link to an outside server, which in turn,
will do some work and then post back to my application. However, the
outside application is URL Encoding my URL, which in turn,
causes the URL to look like:
mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
This cannot be handled by IIS, and induces a "page cannot be displayed
error"; which in effect, causes the application to terminate.
Is there any way that we can trap this error and redirect to the appropriate
location so that the web application does terminate, or is there a way
we can prevent the brackets within this application.
Hope I explained this correctly.
Appreciate any help.
Regards,
Malcolm KlotzOne approach - not clean - you can catch the IIS error code 404 and then
handle the issue on a redirect page. Sorry, I can't think of anything
cleaner at the moment.
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Malcolm Klotz" <nonesuch23@.online.nospam> wrote in message
news:OvlaLxATFHA.2812@.TK2MSFTNGP09.phx.gbl...
> Hello,
> I have a problem with ASP.Net:
> I have an ASP.Net application on a web farm, using SQL Server Session
> State Management, running on Windows 2000 (IIS 5)
> With session management on, a URL like the following is created:
> https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
> The problem I am having is that at some point within the web
> application
> I have to pass this link to an outside server, which in turn,
> will do some work and then post back to my application. However, the
> outside application is URL Encoding my URL, which in turn,
> causes the URL to look like:
> mywebapp.com/(suyvga3bcnzwrljiaxdfud30)/vbvnet.aspx
> This cannot be handled by IIS, and induces a "page cannot be displayed
> error"; which in effect, causes the application to terminate.
> Is there any way that we can trap this error and redirect to the
> appropriate
> location so that the web application does terminate, or is there a way
> we can prevent the brackets within this application.
> Hope I explained this correctly.
> Appreciate any help.
> Regards,
> Malcolm Klotz
>
Thanks for Alvin's inputs,
Hi Malcolm,
Since you are using the cookieless Session(embed sessionid in the url
string) in your web app, is there any particular requirement in your
scenario that we must use cookieless session? Is it possbile that we use
cookieenabled session instread?
Also, as for passing the url to a outside server, I think we have the
following means:
1. If we are forced to use cookieless session and with the sessionid
embeded in the url, I suggest that we filter the sessionid when pass the
url out to the remote server. For example:
when giving the following url
https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
we can use substring concating or regex to get the url without embeded
sessionid like:
https://mywebapp.com/start.aspx
this can also work for the remote requster, the only difference is that the
request with non-sessionid url will be unable to retrieve the data in the
SessionState associated with the id. Do you think this means possbile?
2. If we also want to let the remote server be able to retrieve the
sessiondata, I suggest that we still pass the urlstring without embeded
sessionid , but also pass the SessionId string as separate data to that
remote server together with the url string. How do you think of this?
Please feel free to post here if you have any other questions or ideas.
Thanks,
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thank you, you have given me a place to start.
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:eSJz3kGTFHA.2476@.TK2MSFTNGXA01.phx.gbl...
> Thanks for Alvin's inputs,
> Hi Malcolm,
> Since you are using the cookieless Session(embed sessionid in the url
> string) in your web app, is there any particular requirement in your
> scenario that we must use cookieless session? Is it possbile that we use
> cookieenabled session instread?
> Also, as for passing the url to a outside server, I think we have the
> following means:
> 1. If we are forced to use cookieless session and with the sessionid
> embeded in the url, I suggest that we filter the sessionid when pass the
> url out to the remote server. For example:
> when giving the following url
> https://mywebapp.com/(ts2t2uivrj3vxg452ah33cvg)/start.aspx
> we can use substring concating or regex to get the url without embeded
> sessionid like:
> https://mywebapp.com/start.aspx
> this can also work for the remote requster, the only difference is that
the
> request with non-sessionid url will be unable to retrieve the data in the
> SessionState associated with the id. Do you think this means possbile?
> 2. If we also want to let the remote server be able to retrieve the
> sessiondata, I suggest that we still pass the urlstring without embeded
> sessionid , but also pass the SessionId string as separate data to that
> remote server together with the url string. How do you think of this?
> Please feel free to post here if you have any other questions or ideas.
> Thanks,
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
You're welcome Malcolm,
Good luck! :-)
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Session varaibles are lost when an error occurs
(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
(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 and postback question
I have this web form where I have something like
--In pageload
If not ispostback then
session("drc") = ......
end if
and I intend to use this drc(datarowcollection) throughout a user session.
My problem is this: When a postback occurs because of say a buttonclick or radiobutton click then everything happens as I expect it to work. But when in the middle of a session I press the Refresh button of the browser (IE), then it goes into the code above i.e. page.postback = false. Because of this, I am facing a lot of difficulty. Is this something to do with the session variable. Is there another way in which I can store the datarowcollection so that I can use the same throughout the session.
_Please Help_. I would really appreciate it.
Thanks,
dotosuSo if it is NOT a postback you check for the existence of the session variable and if it does NOT exist you create what you need and then store it in there? Or you just assume that the session variable is not in there at all?
But my question is if say session.timeout = 20 and I go to this page in question and move around for 5 minutes, everything is working fine but then if I hit the Refresh button on the browser then it goes into If not page.ispostback statement. Now, it is not supposed to do this since it is not really bringing up the page for the first time, right?
Am I missing something here?
PLEASE HELP!!
Thanks, dotosu
Would anyone know why this might be happening. I would greatly appreciate help.
-dotosu
To the web server it is bringing up the page for the first time whether the session has timed out or not. This is if you do a refresh without first doing a postback.
I don't think I understand what your difficulty is here. Could you try to explain it another way and maybe I can offer more help?
I think I am sort of confused here. Please check my first post in this thread for an explanation of what my problem is. I don't think I can explain it any better but I sure need some help with this.
Now as far as I understand, we have such a sub
Sub Page_Load(...)Do I not understand this correctly?
If Not IsPostback Then
'do something for situations when the page is first brought up
Else
' do something for situations when the page is brought up after first time
End If
End Sub
Thanks,
dotosu
Try this;
If Page.IsPostBack = False Then
'check if a session already exist
If Session("drc") = 0 Then
'set the session
Session("drc") = "yourinfo"
end if
</code
Hope this helps..
Sorry about my last oversight
Try this;
If Page.IsPostBack = False Then'check if a session already exist
If Len(Session("drc")) = 0 Then
'set the session
Session("drc") = yourinfo
end if
Len is for the expression object (zero) as integer
Session variable being cleared--why?
variables are cleared.
I noticed that there is a "EnableSessionState" property on the document
object that has three allowed states "True", "false" and "Readonly". I
would assume that by default, if not specified, it is "true".
however, I decided to explicitly set it to true to see if it helps.
i set it to true in the WebForm. no luck.. Then i realized that it used a
Master Page, so I tried to set the same property there to true.
I get the following error message:
Error 3 Error parsing attribute 'enablesessionstate': Type
'System.Web.UI.MasterPage' does not have a public property named
'enablesessionstate'.
C:\MyDocs\vss\SMIT\SMIT.PackTrack\PackTrack.NET\BIMasterPage.master 1
Any idea why I can't set this property or how to prevent the Session
Variable from being cleared. I access the web page using a relative Url, do
not explicitly clear the variable, am not using frames, am using only 1 IE
Window.
Can anyone suggest a reason why this is happending?
Also, on a separate thought...Is there any easy way to log response times
(Page Post times) in a centralized way such as the ASAX file. I assume there
is something in TRACING, but I dont know much about. A little direction
point would be helpful.
Thanks!I found the issue:
I did something like this is the top of my aspx code behind class:
Private UserId As String = Session("UserId")
I change it to
Private UserId As String
and in the form load add:
UserId = Session("UserId")
Apparently, variables are initialized before the session object is
avaialable for use.
"Chad" <chad.dokmanovich@.unisys.com> wrote in message
news:f46kr0$isr$1@.trsvr.tr.unisys.com...
> When I visit a specific web page, Request.aspx, for some reason my session
> variables are cleared.
> I noticed that there is a "EnableSessionState" property on the document
> object that has three allowed states "True", "false" and "Readonly". I
> would assume that by default, if not specified, it is "true".
> however, I decided to explicitly set it to true to see if it helps.
> i set it to true in the WebForm. no luck.. Then i realized that it used a
> Master Page, so I tried to set the same property there to true.
> I get the following error message:
> Error 3 Error parsing attribute 'enablesessionstate': Type
> 'System.Web.UI.MasterPage' does not have a public property named
> 'enablesessionstate'.
> C:\MyDocs\vss\SMIT\SMIT.PackTrack\PackTrack.NET\BIMasterPage.master 1
>
> Any idea why I can't set this property or how to prevent the Session
> Variable from being cleared. I access the web page using a relative Url,
> do not explicitly clear the variable, am not using frames, am using only 1
> IE Window.
> Can anyone suggest a reason why this is happending?
> Also, on a separate thought...Is there any easy way to log response times
> (Page Post times) in a centralized way such as the ASAX file. I assume
> there is something in TRACING, but I dont know much about. A little
> direction point would be helpful.
> Thanks!
>
>
Session variable being cleared--why?
variables are cleared.
I noticed that there is a "EnableSessionState" property on the document
object that has three allowed states "True", "false" and "Readonly". I
would assume that by default, if not specified, it is "true".
however, I decided to explicitly set it to true to see if it helps.
i set it to true in the WebForm. no luck.. Then i realized that it used a
Master Page, so I tried to set the same property there to true.
I get the following error message:
Error 3 Error parsing attribute 'enablesessionstate': Type
'System.Web.UI.MasterPage' does not have a public property named
'enablesessionstate'.
C:\MyDocs\vss\SMIT\SMIT.PackTrack\PackTrack.NET\BI MasterPage.master 1
Any idea why I can't set this property or how to prevent the Session
Variable from being cleared. I access the web page using a relative Url, do
not explicitly clear the variable, am not using frames, am using only 1 IE
Window.
Can anyone suggest a reason why this is happending?
Also, on a separate thought...Is there any easy way to log response times
(Page Post times) in a centralized way such as the ASAX file. I assume there
is something in TRACING, but I dont know much about. A little direction
point would be helpful.
Thanks!I found the issue:
I did something like this is the top of my aspx code behind class:
Private UserId As String = Session("UserId")
I change it to
Private UserId As String
and in the form load add:
UserId = Session("UserId")
Apparently, variables are initialized before the session object is
avaialable for use.
"Chad" <chad.dokmanovich@.unisys.comwrote in message
news:f46kr0$isr$1@.trsvr.tr.unisys.com...
Quote:
Originally Posted by
When I visit a specific web page, Request.aspx, for some reason my session
variables are cleared.
>
I noticed that there is a "EnableSessionState" property on the document
object that has three allowed states "True", "false" and "Readonly". I
would assume that by default, if not specified, it is "true".
>
however, I decided to explicitly set it to true to see if it helps.
>
i set it to true in the WebForm. no luck.. Then i realized that it used a
Master Page, so I tried to set the same property there to true.
>
I get the following error message:
>
Error 3 Error parsing attribute 'enablesessionstate': Type
'System.Web.UI.MasterPage' does not have a public property named
'enablesessionstate'.
C:\MyDocs\vss\SMIT\SMIT.PackTrack\PackTrack.NET\BI MasterPage.master 1
>
>
Any idea why I can't set this property or how to prevent the Session
Variable from being cleared. I access the web page using a relative Url,
do not explicitly clear the variable, am not using frames, am using only 1
IE Window.
>
Can anyone suggest a reason why this is happending?
>
Also, on a separate thought...Is there any easy way to log response times
(Page Post times) in a centralized way such as the ASAX file. I assume
there is something in TRACING, but I dont know much about. A little
direction point would be helpful.
>
Thanks!
>
>
>
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
Session variable losing value
user information (username, security areas, configuration data). When
the user logs into the system I store all of this information in a
class and then dump it into a session variable. The timeout on the
server is set to 2hrs. Every now and then (5min-30min) the web server
will lose the session variable. This is very inconsistent and doesn't
appear to have an associated pattern. Has anyone else come across this
issue and determined the root cause?
I've found a lot of posts that describe this issue but none that
actually pinpoint the cause or solution.
Please don't recommend that I use cookies, some other solution or
question why I'm storing this information in a session variable. The
application is structured in this way to meet specific user/regulatory
requirements and user imposed constraints.
Thanks!
NateAre you sure that the user keeps interacting with your web site for 2 hrs
after he logs in? Typically, I guess you maintain one session class object
per user and populates this class once the user logs in. Once the user
terminates his session (by logging out and closing the browser), it is lost.
That is how a session is defined logically.
"Nate Spillson" <nateusenet@.spillson.com> wrote in message
news:1ce32cdf.0308060908.7944a2b@.posting.google.co m...
> I have an asp.net web application that uses session variables to store
> user information (username, security areas, configuration data). When
> the user logs into the system I store all of this information in a
> class and then dump it into a session variable. The timeout on the
> server is set to 2hrs. Every now and then (5min-30min) the web server
> will lose the session variable. This is very inconsistent and doesn't
> appear to have an associated pattern. Has anyone else come across this
> issue and determined the root cause?
> I've found a lot of posts that describe this issue but none that
> actually pinpoint the cause or solution.
> Please don't recommend that I use cookies, some other solution or
> question why I'm storing this information in a session variable. The
> application is structured in this way to meet specific user/regulatory
> requirements and user imposed constraints.
> Thanks!
> Nate
It really depends on what you mean by "logging out and closing the browser".
If there is code to call Session.Abandon() in the sign out code, then yes,
this ends the session. But you don't know if there is.
Simply closing the browser does not end the session. The session continues
until the timeout.
However, any new browser instances will create a new session - while the
original one is still alive until the timeout occurrs.
Things that can occur an applications restart:
1) chaging DLL's, web.config, etc on the server
2) certain antivirus scanners that scan the above files, thus triggering a
restart
"Rao TRN" <trn_study@.hotmail.com> wrote in message
news:%23cJ6n9DXDHA.2620@.TK2MSFTNGP09.phx.gbl...
> Are you sure that the user keeps interacting with your web site for 2 hrs
> after he logs in? Typically, I guess you maintain one session class object
> per user and populates this class once the user logs in. Once the user
> terminates his session (by logging out and closing the browser), it is
lost.
> That is how a session is defined logically.
> "Nate Spillson" <nateusenet@.spillson.com> wrote in message
> news:1ce32cdf.0308060908.7944a2b@.posting.google.co m...
> > I have an asp.net web application that uses session variables to store
> > user information (username, security areas, configuration data). When
> > the user logs into the system I store all of this information in a
> > class and then dump it into a session variable. The timeout on the
> > server is set to 2hrs. Every now and then (5min-30min) the web server
> > will lose the session variable. This is very inconsistent and doesn't
> > appear to have an associated pattern. Has anyone else come across this
> > issue and determined the root cause?
> > I've found a lot of posts that describe this issue but none that
> > actually pinpoint the cause or solution.
> > Please don't recommend that I use cookies, some other solution or
> > question why I'm storing this information in a session variable. The
> > application is structured in this way to meet specific user/regulatory
> > requirements and user imposed constraints.
> > Thanks!
> > Nate
Session variable not set
I built a web application using cookieless session. It merely checks
for the session variable value upon login. This method works fine on
the host pc.
However, when i try to access the application via another pc in the
network, the login page redirects to itself even though the correct
passwd and usename is entered. I did a response.write and realise that
the value of the session variable is not set. How can i solve this
prob?
Any Help is greatly appreciated.
Tks...ywzCheck out http://weblogs.asp.net/bleroy/archi.../03/207486.aspx
it might solve your problem...
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"ywz" <ywz.oct13@.gmail.com> wrote in message
news:1113293239.075593.241860@.o13g2000cwo.googlegroups.com...
> Hi All,
>
> I built a web application using cookieless session. It merely checks
> for the session variable value upon login. This method works fine on
> the host pc.
> However, when i try to access the application via another pc in the
> network, the login page redirects to itself even though the correct
> passwd and usename is entered. I did a response.write and realise that
> the value of the session variable is not set. How can i solve this
> prob?
>
> Any Help is greatly appreciated.
> Tks...ywz
>
The fact that it works on one and not the other means this is probably not
the answer, although this is a great post.
The major problem, IMO, is the fact that ywz is using an ASP methodology
(session var) in an ASP.NET world.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Karl Seguin" wrote:
> Check out http://weblogs.asp.net/bleroy/archi.../03/207486.aspx
> it might solve your problem...
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
>
> "ywz" <ywz.oct13@.gmail.com> wrote in message
> news:1113293239.075593.241860@.o13g2000cwo.googlegroups.com...
>
>