How To Detect If SessionState Has Expired
Nov 9, 2010
What would be the best way to detect if the SessionState has died in order to send the user to a "Session Expired" page? I've successfully configured the app (in Web.config) to do this when the authentication cookie is gone (there's a setting for that), but so far I haven't found an effective way to do something similar when the SessionState is gone. The app in question holds some data in the Session, and should present the user with a "Session Expired - login again" page if any of them is gone.
So far, the only option I can think of doing it in each of the places I access Session, but this is obviously a less than optimal solution.
View 5 Replies
Similar Messages:
Jul 22, 2010
I am creating a web application using ASP.Net. I am using session in my application.
There is one scenario where I am trying to access session variable through Javascript. It is working fine, when I m accessing it in normal state. But after session expiry, if click on any button, it throws exception and behaves abnormally, resulting in page not found.
Here is the code I am using;
var TransactionID = '<% =((Hashtable)(Session["SessionData"]))["TransactionID "] %>';
if(TransactionID !='')
{
//action
}
I am trying to achieve something like of sort in c#;
String lsStr;
if(null != lsStr)
{
//action
}
View 2 Replies
Aug 21, 2010
i'm interested to do the following - i geuss, i have no option to do that:
we have our "mainapplication" on a DB; we are tracking user-login status by switching a bit in the DB in the users data row.
we hvae a second application, the backend, which is the administration tool.
(the applications are put in seperate diretories on HD)
sometimes, we need to block/ban users. in some cases the users are logged in, when we "see them in action".
i'd like to build a button in the backend-application, which logss-out the user from the mainapplication.
for sure: i can access the same DB and switch the bit to "know" he's offline, but this will not kill the session on the mainapplication.
because: if a user is on/offline is also indicated by the session in the IIS. and as the IIS-session is active, the user may be already banned - but he will not be logged out automatically (and showing something like "you have been logged out because of a ban) one option would be to call the DB by each page-load to find out, if the user is logged on.
View 7 Replies
Jul 7, 2010
I set ViewState["zzz"] and Session["zzz"] to the same string.
When I compare using == I get false.
When I do ViewState["zzz"].Equals(Session["zzz"]), I get true.
In the debugger, both their values show the same string, and when I do
? ViewState["zzz"] == Session["zzz"]
I get false.
I thought the ViewState StateBag Item defaults to the set value and the Session Item defaults to the value as well?
View 1 Replies
Dec 22, 2010
There is a timeout for Session object of HttpSessionState that can be set. I want to see if we can make HttpApplicationState timeout too?
View 2 Replies
Nov 26, 2010
What am I doing wrong. The sessionState Timeout never fires,It only fires after 24 hours, I want to let it fire in 20 minutes on my webpage. In the web.config I handle the sessionstate like this:
<sessionState cookieless="false" mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
timeout="1" stateNetworkTimeout="1"/>
timeout="1" is on purpose, for testing.And in the code I check on which session I am by calling Session.SessionID.ToString()
View 3 Replies
May 3, 2010
i am having problems with an asp.net c# site whereby i am setting a session state object to true and then redirecting to another page that needs to check the value of the session state object and it is null.
Sometimes it is set correctly and other times is is simply null.
When i debug on my local machine it works perfectly every time. Only when i upload to my web server does this temperamental behaviour happen.
As it is based around the security of the site it is obviously important that the session data be valid and accurate every time.
Is session state data unreliable?
AFAIK its set to inproc, cookieless, 30 min timeout, vanilla installation of IIS.
Does anyone have any suggestions? Perhaps i need to thread.sleep inbetween the storing of the session data and the reading?
NB: the time between the write and the read is about 70ms.. ample time for the data to be written to RAM.....
View 4 Replies
Oct 25, 2010
active users on my website with sessionstate set as sqlserver.
And what if a person closes his browser then how to maintain the user count?
View 1 Replies
Feb 11, 2011
I'm managing a rather large project, written in asp.net webforms + mvc3, with a large user base, and a pretty high daily visitor count. Basically, there are a lot of requests at any given moment.
One of my controllers in MVC that handles / resizes images on the fly has the following attribute applied to it:
[SessionState(SessionStateBehavior.Disabled)]
Now, if an action in the controller tries to access the session - it obviously throws an exception - so we're good so far. The problem is: if I go to the IIS Worker Processes window (Win Server 2008 R2, IIS 7.5), and check the current requests for this site, I can sometimes see the requests to an action in this controller. Their current state is locked in State: RequestAcquireState, Module Name: Session. Sometimes these locks go over a second or two in this state.
Wasn't the whole point of the attribute in the first place to make the requests to the controller ignore the state, and not waste time (and possibly being locked) trying to acquire the state? If this is so - am I doing something wrong here, or does the problem lie elsewhere?
View 1 Replies
May 13, 2010
[Code]....
From my understanding, the asp.net 1.1 application will login the user then store the information to a session and a cookie? I'm trying to access that cookie with a asp.net 2.0 application. Is this possible?
I'm thinking the mode would need to change to maybe StateServer or Sql.
View 14 Replies
Dec 9, 2010
I'm having a problem with getting a valid Session object in the GetHttpHandler() method of a IRoutHandler. Here is my code:
[Code]....
No luck, Session is still null.
View 6 Replies
Feb 12, 2011
I have been thinking of ways to optimize the out of state storage of sessions within SQL server and a few I ran across are:
Disable session state on pages that do not require the session. Also, use read-only on pages that are not writing to the session.
In ASP.NET 4.0 use gzip compression option.
Try to keep the amount of data stored in the session to a minimum.
Right now, I have a single object (a class called SessionObject) stored in the session. The good news is, is that it is completely serializable.
Optimizing using protobuf-net An additional way I thought might be a good way to optimize the storage of sessions would be to use protocol buffers (protobuf-net) serialization/deserialization instead of the standard BinaryFormatter. I understand I could have all of my objects inherit ISerializable, but I'd like to not create DTO's or clutter up my Domain layer with serialize/deserialize logic.
View 1 Replies
Oct 18, 2010
I am trying to config my application to use out-of-process sessionState.
<sessionstate mode="stateserver" cookieless="false" timeout="20" sqlconnectionstring="data source=127.0.0.1;user id=<user id>;password=<password>" server="127.0.0.1" port="42424" />In my web.config I get errors for the server and port attributes, telling me that server attribute is not allowed and port attribute is not allowed.
View 2 Replies
Nov 24, 2010
In my web.config I have:
<sessionState configSource="SessionState.config">
</sessionState>
In SessionState.config I have:
<sessionState timeout="90" mode="SQLServer" allowCustomSqlDatabase="true" cookieless="false" sqlConnectionString="Data Source=.;Persist Security Info=True;Integrated Security=True">
</sessionState>
I've tried various incantations but can't seem to get it to work. I get this error:
Parser Error Message: Unable to open configSource file 'SessionState.config'.
From MSDN:
Of course they don't show an actual example.
I verified that the file is in the bin directory. I also have this working fine for the connection strings section.
How do I use a remote config file for sessionState?
View 1 Replies
Feb 23, 2011
I changed my application to use "InProc" sessionState instead of "Off" because I need to preserve user selected language from page to page doing localization.n web.sitemap I have this line:
<siteMapNode url="Admin.aspx" title="Administrator" description="Site administration" roles="Administrator" />
which before I changed sessionState to "InProc" worked as supposed to: menu item "Administrator" appeared as a menu choice only when user had logged in with admin rights. Now this menu choice is present for every user.
View 3 Replies
Jun 30, 2010
what the difference between
SessionState Timeout
and
HttpRuntime ExecutionTimeout
is? Both in web.config. I want to increase or reduce the timeout in my webapplication. Means: If a users idles more than 10 min. the should get timed out.
View 2 Replies
Jul 28, 2010
I'm completely stuck with this version 1.0.0.0 product.
I'm running in a domain environment but for the specific application i'm using I want to disable security to reduce the workload on the servers when accessing the cache.
I've got a bunch of web servers with an existing application using SQL sessions state, and the idea was to roll out AppFabric and use the session state provider and a fast solution to speed things up. Currently have a single separate server running appFabric Host.
All Servers are on the same domain.
I've got AppFabric Running using this mode on the host
Set-CacheClusterSecurity -ProtectionLevel EncryptAndSign -SecurityMode Transport
Local App Pool on the web servers is using NETWORK SERVICE account, and i've grantedthe machine accounts permissions and it all works fine.
But then on the server i set this
Set-CacheClusterSecurity -ProtectionLevel None -SecurityMode None
(Stopping and Starting the cluster).
Then after that I get this error.
ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified Cache servers are unavailable, which could be caused by busy network or servers. Ensure that security permission has been granted for this client account on the cluster and that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Retry later.)
My assumption is that the client (session state provider), is set by default to use security and need to be set not too, but can't find any doco on how to change this, or i could be barking up the wrong tree.
View 1 Replies
Feb 4, 2010
We have a webfarm using a SQL Server 2000 database to store our session state.
On the same SQL server are our databases for the rest of the websites. The databases are separate but on the same server.
Recently I found that one of our developers is using the session very inefficiently. He is storing large datatables within the session for users when he could accomplish the same thing through other methods.
Can this inefficient use of the session state (when stored in SQL Server) affect the performance of our main database when they are on the same server?
The answer seems to be yes, to some degree. However, I cannot find any documentation to back me up.
View 3 Replies
Mar 16, 2011
My session variables don't get saved if the SessionState mode in the web.config file is set to StateServer. But when I changed it to InProc, then everything is fine and good. I'm trying to save a custom built object (or class) into the session after the user logs in.
View 4 Replies
Nov 12, 2010
I am performing my first steps with ASP.NET for my employment.Yesterday I tried to perform saving a value to a sessionstate variable, but it does not work.I am using C# and want to code in .NET 3.5. [Code]....
The click performs a postback to a second website where the value is to be displayed on a simple label.The value I initialized in the Global.asax is saved to the variable and then read on the second page, but I cannot manipulate it using the textbox and the button on the first page. I just don't get it...I even tried on different machines and different VS editions.
View 7 Replies
Sep 8, 2010
I'm building a site using the .NET 4 framework using routing and MasterPages.
Because I'm using both routing and MasterPages, I can't see any way how to get value from control on the previous page. To solve this I've used the code behind to store the control's value in a session variable. Is there a way to retrieve a value from a control using PreviousPage or something when using Routing and MasterPages?
This works fine in VWD debug mode and in IIS 5.1, but when I try to deploy it on my Windows Server 2008 (IIS7.5) machine, it get this error:
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration><system.web><httpModules> section in the application configuration.
Here is a copy of my web.config file:
[Code]....
View 4 Replies
Jan 11, 2010
have developed one dnn 4.9 application, while filling any input form, if i press on back page the following warning is displayed,Webpage has expired
View 1 Replies
Jun 21, 2010
I get this error (webpage expired) in internet explorer and not in firefox.How to to solve this error??
View 14 Replies
Dec 15, 2010
The problem is I have a stored procedure that runs consistently in Sql Server Management Server with a time of 2 seconds but when calling that same stored procedure from code it times out.
When it runs correctly from SSMS it should return about 30 rows.
I've tried a few different ways to call the procedure from code but every time the same result. This just recently started happening, yesterday it was working fine.
The preferred method for calling the procedure for us is using Linq2Sql which gives the following error message:
[code]....
View 2 Replies
Jan 10, 2011
server some times im getting the error like Webpage has expired what is this problem and how to resolve this?
View 2 Replies