State Management :: How To Clear Private Data
Aug 2, 2010I need to clear private data programmatically when someone clicks logout ?
View 5 RepliesI need to clear private data programmatically when someone clicks logout ?
View 5 RepliesI am working on rewriting an application. The previous developers have declared some Private static hashtables within a class in a class library. The first time when the application runs, this hashtable gets populated by running the query. After that this hastable is refrenced elsewhere to get the employee information.Even if the employee is removed from the DB, he is still able access the application, Since the private static hashtable holds the employee information. I totally understand that the hashtable is referenced to prevent the DB calls everytime.
The problem is even after closing the browser and restarting the application the hashtable holds the employee information. How do i get clear this so that it calls the DB?
I have a form that takes the user information. When the user submits the form, after the postback, I need to get all some of the textboxes in the form cleared. I tried disabling the ViewState and ViewStateMode. But both of them failed. Also tried disabling the cacheability for the page. I know I can clear the textboxes on the page load event. But I am curious to know if there is another way to do this.
View 7 RepliesI am using master page and i use session id to identify coming user before navigation
i have a link button to logout ..this link button only will navigate to login page
once navigated if i click back i am still able to browse the page
clickin logout button not cleanin the session? how to avoid page click back?
or how to clear session id when user click logout?
I have multiple sites with main and subdomain. all doing one same method for the login. login is done with the multi domain cookie but there is problem with the logout. I'm using cookie and session for that state.
When ever I logout form the any domain. I should logout form the all domain.
(Like yahoo or google)
As per my method , My all domain have logout page which has code
[Code]....
and main site(www.domain.com) have
[Code]....
So what can I change in this code to do the Logout process for the all subdomains.
I have a report parameter page which contains many pop up windows for the parameter selection. For example, for driver , there is a pop up window called driver.aspx which contains a listbox that contains list of driver's name.
Now, for each of these pop up windows, i am passing the values of these windows as a session value.
Now, when a user logs in the system, there are many parameter pages for different reports which commonly share the same pop up windows if the parameters are same for different reports.
The problem now is,a user selects 10 drivers for report 1 and runs it. When he goes to report 2 and runs the report, the report 2 takes only those 10 drivers as the driver parameter value.
It means, the error can arise on the system because he may forgot that he have selected 10 drivers for previous report 1. User will not have time to recheck each previous selected values of different paramaters.
What i want is, when a person moves from one report page to another, i want to clear all the session values and adjust it as default for the new report .
how to clear cokkies when my website open
View 3 RepliesHow to set session timeout and clear session in web.config and login.aspx ? And when we close the web application , the session must be cleared? I have use session.abandon as per below but is not working.
protected void btnLogout_Click(object sender, EventArgs e)
{
Session.RemoveAll();
Session.Abandon();
Response.Redirect("LoginPage.aspx");
}
I have 4 webpages. In those pages, i am using session variables,viewstates,cookies. I am passing session variables,viewstates to different pages. Now the problem is sometimes i am getting the old cookie values or session values. I want to clear all these things when i close the browser or if i open a new tab of browser.
View 10 RepliesI am wondering if it is possible to clear a session variable if the user navigates away from my site.
My example is I have a session storing the logged in user. This is checked for user access to each page.
If the user goes to another site (e.g. google) I want them to relog into the site.
This is to prevent others getting access to a users account if they use the same pc minutes.
I do have a logout that performs this and I know that it is impossible to make users use it! :)
I would like to clear sessions after hitting back button . Iuse the java script to disable back button how can i clear sessions now after hitting back button.
I use the following script
<script type="text/javascript">
function preventBack(){window.history.forward();}
setTimeout("preventBack()", 0);
window.onunload=function(){null};
</script>
I am using asp.net 3.5 and use master pages for most of the website. I need to make sure that users after they logout are not able to use the back button to see in cache data.
View 4 RepliesI am caching a file in ttpContext.Current.Application object. Now when I change the values in file, it does not get reflected in the application (I am reading the values from the file for app version).
Even after restarting the app pool and the website in IIS, the changes does not reflect. I dont want to restart IIS.
I have an content page that got
<%@ OutputCache Duration="600" VaryByParam="*" %>
Now i want to display a link on the same content page that actually clear the cache.
[Code]....
But its just not working, What i am doing wrong here?
how to create a logout page that clears the session and cookies??? using c# .net...
View 5 RepliesWe have a scenario where we need to store large tables of data on Session in asp.net page. on a highlevel we have to store following data
1> A table (table 1) with 1000 rows and 8 to 10 columns.
2> A table(table 2) with 500 rows and 8 to 10 columns (actually user can add the data from table 1 to table 2, so as user keeps on adding from table 1 we remove the data and put it in table 2)
3> Another table(table 3) with 1000-1200 rows each having 3 columns.
We are having a webfarm, so we need to store it in either SateServer of Oracle DB,What would be the performance implications of storing such huge data on the server.
One more thing is at any point of time max of 70 -80 people will be accessing our website, so will this cause any performance degradation?
when we go for client and server side state management in asp.net
View 2 RepliesI have recently moved our ASP.NET session state from InProc to a Sql Server solution. I can see session data being inserted into the Sql Server database. I'm monitoring the w3wp.exe process using the "Private bytes" & "# Bytes in all heaps" performance counters.As I navigate through the website it places data into session, however the private bytes counter still climbs on the server hosting the website? I thought the session data was being written to the database and not being stored in memory? The managed bytes remain constant, and I'm pretty sure all the objects going into the session are managed types.
View 1 RepliesI am doing a POC of making my website run faster. Currently it stores huge object data in Session while passing information from one page to another. What I was thinking is to use shared methods and properties instead of session. It works, but wanted tocheck if this is an optimum way to do it. Below is the code that does not use session but still pass object data from one page to another:
[code]...
i have a form on page1.aspx with several controls (textbox, dropdownlist, etc).on Page1 PageLoad event i load data from database and performe databinding.From Page1 a user can, by clicking a specific button, move to Page2.aspx to insert some details and, after saving details, he returns to page1.
if save changes are made on control on page1 before save them to db, obviously, these are lost on return from page2 (because are reloaded on pageload from db).How can i save control status between pages round trip?
i need to know the full concepts state manegemnt in asp.net,..in which site i will get the correct concept for state management....
View 4 RepliesUser Interface: 2 Labels; 1 Buttons
Requirements: Create a Web Page in ASPx that will do the following:
1)One label will provide a count of how many times Button 1 has been clicked in the current session.
2)One label will provide a count of how many times Button 1 has been clicked by all users of the application. The Application Code for the Button should start at 100 (set this in the Global.asax file). this is what i have so far but i cant seem to get the application state to work properly.
aspx.vb
Partial Class _Default
Inherits System.Web.UI.Page
Dim clickcount As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("ClickCount") Is Nothing Then
clickcount = 0
Else
clickcount = CInt(Session("ClickCount"))
End If
If Not IsPostBack Then
If Request.Cookies("UserName") IsNot Nothing Then
Label1.Text = "Welcome Back " & Request.Cookies("UserName").Value & "."
End If
End If
Dim clickCounta As Integer = CInt(Application("ClickCount"))
End Sub
Protected Sub PostBackSession_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.Click
clickcount += 1
lblClkCnt.Text = "Current Click Count is " & clickcount
Application.Lock()
Dim clickCounta As Integer = CInt(Application("ClickCount"))
clickCounta += 1
Application("ClickCount") = clickCounta
Application.UnLock()
AppClick.Text = clickCounta
Dim nameCookie As New HttpCookie("UserName", _
TextBox1.Text)
nameCookie.Expires = Now.AddYears(1)
Response.Cookies.Add(nameCookie)
End Sub
Protected Sub PostBackSession_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.PreRender
Session("ClickCount") = clickcount
Application("ClickCount") = clickcount
End Sub
End Class
global.asax
<script runat="server">
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim clickCounta As Integer = CInt(Application("ClickCount"))
Application.Add("ClickCount", 0)
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
Dim clickCounta As Integer = CInt(HttpContext.Current.Application("ClickCount"))
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
End Sub
I have a large SQL Database in the server from which I can create a dataset of about 10000 rows. My question is about caching this data. Which type of data caching should I choose (Server side or Client side)? Which one will provide better performance?
View 5 RepliesCustomer were getting "View State Validation Error" due to worker process recycling at our production webserver and to fix that i applied machinekey and then move my Session state Mode from In Proc to State Server to retain session data and not kick out the customer to relogin. I had serialization issue with one object which has to be stored in session but when i moved it out of session i could able to resolve the issue.
But doing all these i was partly successfull in keeping the user in their session when Worker Process recycle event occurs.I was able to refresh the page or make a post back by clicking the refresh button and also able to retain the session values. But the Problem occurs when sending asynchronous request to server which we do periodically every 15 minutes from the moment the user logs in.The web page doesnot update data on website when sending asynchronous request.By Debugging I found at this particular code point it fails to make a postback which is required.
<%=GetHintFromServer%> (When there is no Worker Process recycle i t gets replaced by
WebForm_DoCallback('__Page',message,ShowHint,null,null,false) on postback) Everything works fine when there is no Worker Process Recyling but when it happens looks like sending request asynchronously using javascript fails .Remember When I make a post back by manually clicking submit button everything works fine.
SendRequest(Asynchronous)
function SendRequest(msg, isBusy, chartMsg, vesselMsg)
{
try
{
//confirm("msg"+msg+"isBusy"+isBusy+"chartMsg"+chartMsg+"VesselMsg"+vesselMsg);
_busy = isBusy;
if(chartMsg != null)
{
//confirm("chartMsg"+chartMsg);
_element.SetMessage(true, chartMsg);
}
if(vesselMsg != null)
{
confirm("chartMsg"+vesselMsg);
_element.ShowVesselLoading(true, vesselMsg);
}
_stuckWatchdog = setTimeout( "ClearPendingRequest();", 60000);
var message = msg;
var context = '';
<%=GetHintFromServer%>
}
catch(e)
{
alert( "Exception error on SendRequest(): " + e);
}
}
Let me explain, describing the scenario:In a custom server control (in my case, derived from CompositeControl), in the overidden CreateChildControls method I create a complex tree of subcontrols, using information from a db.The db provides both information on which controls I need to create (the user interface's structure) and the data used to fill these controls.Than the user can interact with the control and change the data (that becomes different to what stored on db).
My custom control lives in the same page where there are other controls, obviously.And these controls can cause a postback at any time.What I need is that my custom control keeps the data entered by the user across these postback, without reverting to the original data and loose the user data entry.
Here is the first doubt:
1)I create the subcontrols dinamically in the CreateChildControls at any page refresh (both on first call than on postback).I know that the framework solves the reference between the posted data and the controls I create in the CreateChildControls in order to set properties and raise control events, but can you tell me when and how it actually does this? In which phase of page life cycle? What happens after the CreateChildControls?
A second doubt:2)If the user interface structure must change as a consequence of the data entered, I had to execute CreateChildControls twice (the first time to recreate the original interface to get the events and the second time to create the new interface)
In which phase of page/control lifecycle do I have to make the second call to CreateChildControls? I do it on Prerender now, but is it right or wrong, and why?