C# - How To Prevent The Session From Expiring While Using AJAX
Sep 17, 2010
I have a .Net 3.5 website which uses windows authentication and expires the session using a meta tag on the prerender of my base masterpage class.
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (Response.ContentType == "text/html")
this.Page.Header.Controls.Add(new LiteralControl(
String.Format("<meta http-equiv='refresh' content='{0};url={1}'>",
SessionLengthMinutes * 60, SessionExpireDestinationUrl)));
}
This works well for pages that do full post backs. However there are a few pages in my application where the user does a lot of work that is inside of an update panel. My company's policy is a timeout of 15 minutes. Which means, after 15 minutes of working inside of an update panel page, the user gets redirected to the application splash page.
Is there a way to reset or extend the meta tag on an async postback? Or perhaps a better way to accomplish this entirely?
View 3 Replies
Similar Messages:
Sep 11, 2012
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
I am using this code for clear cache on browser back button.It is working fine for mozilla firefox and Explorer.But it is not working for google chrome.
View 1 Replies
Dec 29, 2010
When the browser is closed (w/out clicking on log out) and user launches the site using a new session, it does not prompt user to login credential page, rather it takes the user back to the previous session.
View 1 Replies
Jul 16, 2013
I have set sessiontimeout=10 after timeout. I want to show alert message and when I click with Ok button I want to redirect home page ....
View 1 Replies
Jul 5, 2010
since a have an app, that makes heavy use of AJAX (jQuery), I faced a problem of session timeout.
After a little bit of googling I found something like :
[Code]....
In the refresh page I have just this code :
[code]....
jQuery indeed calls refresh page, writes "success", however- session times out.
Am I doing wrong something? Is there a better way to prevent session time out?
View 4 Replies
Jan 15, 2010
I built a small ASP.NET application. It has a global.asax and sets some session variables on Session_Start(...).What could prevent (all) session variables from not being set? Would a session time out do it? What if JavaScript turned off? What else can do it?
View 2 Replies
Dec 13, 2010
Does somebody now a good way to make session not transferable, so an user can't move/copy the session token ID from one machine to another?
View 2 Replies
Dec 2, 2010
Our intranet has a custom membership system (not asp membership) which puts values in the session information to identify users. As the intranet is constantly evolving, I often have to publish changes to the live server several times every day. Each time I do, the users who are logged in's sessions end and they have to log in again. This causes various issues which I won't bore anybody with here.
My question - is there anyway to prevent this, or do I just have to live with it? Have spent the last 3 hours Goggling and can find no solution.
View 3 Replies
May 7, 2015
i'm using session variables for send variables between aspx page and it works fine ...but after some time of inctivity(user) in the page the sessions is los...how can i resolve this issue ? this is my code below how to send session :
protected void Lst_Interv(object sender, EventArgs e)
{
Session["Id"] = gdMedical.SelectedRow.Cells[0].Text.Trim();
Session["Service"] = gdMedical.SelectedRow.Cells[6].Text.Trim();
Session["Nom"] = gdMedical.SelectedRow.Cells[2].Text.Trim();
string pageurl = "LstIntervention.aspx";
Response.Write("<script> window.open('" + pageurl + "','_blank'); </script>");
}
View 1 Replies
Jan 14, 2010
I managed to user to perform multiple log on from other IE window session in my web application if the same log on is currently being used.Unfortunately I have problem to control multiple log on if the user is logging in using tab browsing in the same session. I know this is due to the same session Id but is there any way to trace down to the tab level within the same session?
View 2 Replies
Mar 4, 2010
Hacker's attack the session ID in asp.net application. How can we protect the session identifier from hackers.
View 1 Replies
Mar 22, 2011
how to prevent the two session on a single browser ie: first i opening a site on mozilla then login after logged in . I am opening a new table with the same url login using different user after that suppose there is one link called view my profile on user home page if if click the link on first tab browser, it showing the user details on second tab browser user details ie: previous session.how to prevent or avoid this ?
View 6 Replies
Mar 12, 2010
I'm new to asp world, and I have to keep my new job :)Switching form php to asp.net 3.5 (never used before). What would be the best practice for storing a SESSION variable in my project ?How can I prevent my SESSION to be overwritten if my initialisation code is in the onPageLoad method of my MasterPage ?My variables keeps beeing overwritten, please someone help me and tell me if there is any other solution than dealing with this pageLoad problem.
View 3 Replies
Jun 19, 2010
I'm researched how about prevent session timeout, I tested the solutions links bellow and it works great.
http://www.primaryobjects.com/CMS/Article86.aspx
http://www.codeproject.com/KB/session/Reconnect.aspx
But my Website has one thing that still causing problems... the Website calls an ActiveX. Some time in the user navigation the user clicks in a button and a JavaScript loads an ActiveX with the code bellow.
var objDownload = new ActiveXObject('XXXXXX');
objDownload.ActiveXMethod();
This ActiveX makes a huge processing and this is why I'm want the trick to avoid the session expires. I tested the both above solutions but when the ActiveX is running no refresh happens. Can anyone help with this problem? How the ActiveX can be running and the IE makes the refresh?
View 3 Replies
Apr 11, 2012
How to distroySession in asp.net(vb). When I Distroy the session if i click to the back button it will not redirected to previous page.I used
Session.Abandon()Response.Redirect("Default.aspx")
on the click of logout_linkbutton.but when i click back button in browser its go back to previous page. But when i click on any control it will redirected to Default.aspx.
View 1 Replies
Mar 5, 2013
I have a problem with all multiple tab browsers due to session object. I have a requirement that whenever user opens a new browser I need to show different values, so I thought of using Session as in IE 6 every browser creates a new session. But all other multiple tab browsers IE 8 and FF shares the session(If user has already open the browser and try to open different browser). How can I create new session whenever user opens a new browser window. My application is basically in ASP.NET and server side we have C#.
View 1 Replies
Mar 25, 2010
I have ASP.net application that is basically a data entry screen for a physical inspection process. The users want to be able to have multiple browser windows open and enter data from multiple inspections concurrently. At first I was using cookie based sessions, and obviously this blew up.I switched to using cookie-less sessions, which stores the session in the URL and in testing this seemed to resolve the problem. Each browser window/tab had a different session ID, and data entered in one did not clobber data entered in the other.
However my users are more efficient at breaking things than I expected and it seems that they're still managing to get the same session between browsers sometimes. I think that they're copying/pasting the address from one tab to the other in order to open the application, but I haven't been able to verify this yet (they're at another location so I can't easily ask them).Other than telling them don't copy and paste, or convince them to only enter one at a time, how can I prevent this situation from occurring?
View 5 Replies
Feb 16, 2011
How to prevent Session.Timeout extension on certain event from codebehind?
What I do - I have Session Timeout configured in Web.config file for 10 minutes. Also, I have in my webpage1.aspx, an ASP.NET AJAX control ModalPopup which shows into the page 9 minutes after the user stopped sending requests to webpage1.aspx. I did this with this code:
[Code]....
[Code]....
So, my initial calculations was that 1 minute before the session ends, i'll inform the user something with the ModalPopup. The problem is that when this Timer1_Tick event triggers, the session.timeout renew ( or extends ) and the session ends 10 minutes later (if user still don't send any request from his browser).
Can I write code in Timer1_Tick event which prevent session extension?
View 10 Replies
Sep 12, 2011
I have this code:
protected void Button3_Click(object sender, EventArgs e)
{
DataView dv2 = (System.Data.DataView)Cache["SqlSource"];
if (dv2 == null)
{
SqlConnection con = new
[Code] ....
For some reason, the Cache is not expiring. What is wrong with this code? I am aware that I could do this using the SqlDataSource1.SqlCacheDependency property, but I'd like to know how to do it using the SqlCacheDependency object.
View 7 Replies
Mar 6, 2013
Preventing user to open duplicate web application,while it is running .....
View 1 Replies
Jan 11, 2013
I have 2 issues, the fix to one issue gives me the other issue.
In simple terms I have an asp page that uses ajax to get its data. I do not want to cache this page as the data is out of date if you re-open it. The page has buttons to allow the user to do stuff, such as change the view, so when pressed the page that comes back is the result of a POST.
The page also has links to external websites, this is what happens:
User opens webpage
User clicks a button to change view POST
User clicks a link to external website
User presses Back button which then flags up the "Webpage expired" type messsage because the results are from a POST (I believe)
To get around this I was caching the page, this then leads to another problem, the cached page being out of date (in fact I use external web-parts which show as white blocks as they are NOT cached!).If I wait long enough, the ajax kicks in and the data comes back.
So, I can't cache it without getting a huge delay before being able to see anything, and I have to cache it to get around the POST/expired type issue.
View 11 Replies
May 1, 2012
I am working on Visual Studio.Net 2008 framework 3.5 with (vb).
I have created a session variable, when user logs in successfully. But after login if page kept ideal for sometime session get expired, and automatically redirects to login page.
So, I want that after login page should remain opened and session would never get expired until user clicks on Sign out link or button.
For this do i have to set anything in web.config file?
View 1 Replies
Sep 23, 2010
i am using a multi selecting file upload control which is postBack free.
I am using session timeout.
My problem is that during files uploading my session got expired. Bcoz my uploader not being postback so i can't enhance session timeout. and while uploading my session got expired and process was not ompleted, causes some imp files could not uploaded.
View 2 Replies
Jul 19, 2010
I am planning to sell digital goods on my website (Asp.net). After successful payment the customer will be redirected to the download page of my website, which will display the link to download the digital content stored in my server.
I want to secure the location of the file, by creating a disposable link to the file. Every time a customer visits this page a new download link will be generated for the same file. Also this link should expire after it is downloaded for the first time.
Is it possible to do it in asp.net ( C# preferably )? if yes how can i do it?
View 2 Replies
Sep 27, 2011
So I'm attempting to limit user's access to my database through the web. I have a registration form that asks the user for a name and password, then verifies this against a DB. In order to prevent DB overload, I will limit the user's attempts to 10 in 10 minutes. This is how I am trying to solve this, but cannot verify that i'm using the right approach.
Code:
Dim timeout As Integer = ConfigurationManager.AppSettings("timeout")
Dim userIPkey As String = Me.Context.Request.ServerVariables("REMOTE_ADDR")
Dim i As Integer
If HttpContext.Current.Cache(userIPkey) = Nothing Then
i = 1
[Code] .....
For some reason I can hit the service with a for loop and get to the DB every time. If I try doing this through the browser while debugging the webpage, I get the right error message after 10 attempts, while on the server, or through a reference to localhost I will not get the error message.
View 3 Replies