State Management :: Reload Page Only Once After Being Loaded From IE Favorites Tab?
Nov 3, 2010
I have a page with several panels which are enabled or disabled depending from which page user were redirected to this particular page (based on UrlReferrer). Everything works perfectly until a user adds this page to favorites in IE8 (not sure about other browsers at this point), and then returns to that favorite in the future. It contains the previous data and not the data from the current page . When I click F5 it works again becase page is reloaded from the server and not from IE cache. How can I avoid this issue? Is there any way to force page reload only once! I tried also to put some code into "If Not IsPostBack", but it still does not work.
I have a page that loads a usercontrol dynamically. Depended on the user's actions, this control may be unloaded in Page_PreRender and a different control may be loaded instead. I am attempting to use the solution outlined by Mark DotNet Evans in this post: http://forums.asp.net/p/1491790/3814320.aspx
This all works great, except if the user clicks the refresh button in the browser just after the change of usercontrol. Then, I get an error
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. ...
I assume the error is caused by the browser re-posting the request with the old viewstate that matched the control tree when the page was loaded, but no longer does. How can I prevent getting an error when the user reloads the page?
I have a cascading dropdownlist. The first drop down is for Departments and is databound on PageLoad from the database. The user then selects a department and the second dropdown is populated with the appropriate sub departments via JQuery/JSON which calls an httphandler. The problem is as follows: I select a department and the subdepartments are filled.
I finish what I'm doing on that screen and everything is fine. But then if I go to a different screen and add an additional subdepartment then come back to original screen, the new sub department won't appear in the cascading dropdown. I have to close the browser and restart the session in order for any new sub departments to appear even though they are in the database. I put a breakpoint in the httphandler and noticed that it is only called once per session per each department in the first dropdown. I don't know why this is happening. I want it to call the httphander EVERY time the index of the department dropdown is changed.
I read this article first to try to solve this issue, but I am already loading the controls in the Init phase of the page, yet viewstate is not persisting. Any ideas as to why? (Of note is that this is for a custom module in DNN and I do have some AJAX update panels on the page, though this section is not within an update panel, for what it's worth.)
As an overview of what I've got:
1. LoadControl.ascx - based on reading query string parameters, determines whether to load the master or the detail .ascx. 2. Master.ascx 3. Detail.ascx
In my master control I dynamically load either a master or detail sub-control in the page_Init. The detail page has a treeview control and then uses a multi-view control to display the panel associated with the depth of the node selected on the tree. On the panel being displayed I have a cascading ddl within a detailsview control which initiates a postback to select the child ddl based on the parent ddl selection. However, when the page refreshes after the postback, both ddls have resorted to their default selection.
What is interesting however, and I just realized this as I am typing, is that the Treeview is populated when the page comes back from the postback, so that is only possible if viewstate is being persisted right? (See the page_load code and you'll see that Call PopulateRootLevel(intTreeUserID) which populates the treeview, is not called on postbacks....hmmm.
Any ideas as to why the treeview maintains viewstate but not my ddls???? But though the tree is populated, I do have to explicitly select the node again and set the panel that the detailsview control is on to visible again too....
Now here is the weird thing. First i am running it locally on the built in vs2008 web server.I load my control in fine, do a postback from a linkbutton, locally on my machine it all works fine, no issue.However when it goes onto my host, it falls over with the message:
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.Now i also load controls dynamically and use postbacks and things in the admin area of the site...and that works fine, however my front end just keeps failing? See the code behing below:
I have created a matser page with a two radio buttons, text box and a button. Whenever user sets some values to these control and clicks the button, i will navigating him from one content page to another based on the data he has entered. The problem is after the content page load, the values selected/given in the controls(radio button, text box) are getting cleared.
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 am having a ASP.net application it having three pages ,page 1,page 2,page 3,when the user navigating between this pages I want to maintain the view state in page level after postbacks(i.e.) .If a user visits page 3, passing some query loads some data .then he moves to page 1 doing some entries .after that he once again moves to page 3 now I want to display the data previously available at the time he moves to page 1, same way I want to do to my three pages up to the user logging out.
I am getting this error while executing my Asp.Net application.i am not able to execute application using Visual Studio Interface and when i am trying to execute application from Local IIS. its executing well but when i am trying to click any button for searching etc it is giving this error. The state information is invalid for this page and might be corrupted. The detailed information is
[FormatException: Invalid character in a Base-64 string.] System.Convert.FromBase64String(String s) +0 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +72 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 System.Web.UI.HiddenFieldPageStatePersister.Load() +113[ViewStateException: Invalid viewstate. Client IP: 127.0.0.1Port: 1307User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/22.214.171.1244 Safari/532.5ViewState: /wEPDwULLTIwOTUyMjAzMTgPZBYCZg9kFgICAw9kFgICCw9kFgICAQ9kFhgCAg8QDxYCHgtfIURhdGFCb3VuZGdkDxYFAgECAgIDAgQCBRYFEAUHQ2VudHJhbAUCODBnEAUITm9ydGhlcm4FAjgxZxAFB0Vhc3Rlcm4FAjgyZxAFCFNvdXRoZXJuBQI4M2cQBQdXZXN0ZXJuBQI4NGdkZAIJD2QWAmYPZBYKAgEPEA8WAh8AZ2QPFgUCAQICAgMCBAIFFgUQBQdDZW50cmFsBQI4MGcQBQdFYXN0ZXJuBQI4MmcQBQhOb3J0aGVybgUCODFnEAUIU291dGhlcm4FAjgzZxAFB1dlc3Rlcm4FAjg0ZxYBZmQCBw8QDxYCHwBnZGQWAWZkAgkPD2QPEBYBZhYBFgIeDlBhcmFtZXRlclZhbHVlBQItMRYBZmRkAgsPEA8WAh8AZ2RkFgFmZAINDw9kDxAWAWYWARYCHwEFAi0xFgFmZGQCCg9kFghmDw8WAh4JTWF4TGVuZ3RoZmRkAggPDxYEHgxNYXhpbXVtVmFsdWUFCTUvMjYvMjAxMB4MTWluaW11bVZhbHVlBQk1LzI2LzE5MTBkZAIMDxYQHhlDdWx0dXJlRGVjaW1hbFBsYWNlaG9sZGVyBQEuHgdDdWx0dXJlBQVlbi1VUx4bQ3VsdHVyZVRob3VzYW5kc1BsYWNlaG9sZGVyBQEsHg5DdWx0dXJlRGF0ZUZNVAUDTURZHhZDdWx0dXJlQU1QTVBsYWNlaG9sZGVyBQVBTTtQTR4WQ3VsdHVyZVRpbWVQbGFjZWhvbGRlcgUBOh4WQ3VsdHVyZU...][HttpException (0x80004005): The state information is invalid for this page and might be corrupted.] System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106 System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14 System.Web.UI.HiddenFieldPageStatePersister.Load() +217 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105 System.Web.UI.Page.LoadAllState() +43 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 System.Web.UI.Page.ProcessRequest() +80 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +49 ASP.pages__cmtickets_cmtickets_reports_cmtickets_search_aspx.ProcessRequest(HttpContext context) in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesapp_mobily_alexmare1eddc658e6f2ba5App_Web_b9acfmsy.14.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
i want to save the recent state of all controls against a button1 click event. e.g. recently selected item of a dropdownlist should persist selected when user loads page next time, if he/she had clicked button1 before leaing this page. And same for allother controls on this page.
Here is my scenario.In default.aspx page user selects the country, state, city from drop down list, and store them in cache for further use. but when other user open the web site from other computer it shows the same country, state, and city selected by user 1. Is there any problem related to cache? I have stored data as following.
cache["ctryID"] = ctryID;
I want to show default country, state , city at page load of default.aspx
I want to show my data in next page with well formated in table.I all ready write code for session which show data in next page.but i want to show it in table format and i also want to comapre in database for a price and show too. this is my code for next page:
this code show me data but as i say iwant it in table format and want to comapare session varibles in database i want to show price accoding that particular product. The Pervious page code:
I have created a demo application to read data from the CSV and after read the data from the csv file there is a button to save all the CSV loaded data in the database. When i load the large CSV (2MB) file . after load all the data from the file i will save all the data in datatable and store in view state.
when i click on another Link the page doesn't work and page become expires. Where is the problem.
Its simple doing read CSV file .. file stream closed. store all the csv data in view state. and click on the another link save into the database. but click save database button page expire.
I am using query string to pass values from page 1(log in page) to page 2 and then page 3. I have an .ascx file also, so how can I import the user name from Page1(login.aspx) to menu.ascx file. So that when I click the menu Home the value of the variable remains at the website. I am not aware of session handling thats why I am using this method to pass the valus among the various pages in website.
In logout link's click event i have written Session.Abandon() that will destroy the Session state.I am also handling Session_End event that is fired afterward (written in Global.asax). But one more thing i want is that after Session ends, login page should be redirected (opened).
For that i wrote:
This is working fine on the surface, but after applying debugging i saw that there were unexpected number of calls to Session_Start and Session_End events for two times, then login page was opened.
Why Session_Start and Session_End was called two times ? If i left this process as it is working then may i get some serious error in future ?
I have two pages. The first one contains the authors' records and it has a link called REMOVE. If I click on the link that related to a specific author that will be move to the other page that contain the detail view of this author. I already did that but I make a fault but i don't know it. If I click the link that related to author that has au_id=25. the other page has the first record while the url of this page equle to ? au_id=25