viewstate

How to reduce javax.faces.ViewState in JSF

半世苍凉 提交于 2019-12-02 17:39:11
What is the best way to reduce the size of the viewstate hidden field in JSF? I have noticed that my view state is approximately 40k this goes down to the client and back to the server on every request and response espically coming to the server this is a significant slowdown for the user. My Environment JSF 1.2, MyFaces, Tomcat, Tomahawk, RichFaces Cristian Vat Have you tried setting the state saving to server? This should only send an id to the client, and keep the full state on the server. Simply add the following to the file web.xml : <context-param> <param-name>javax.faces.STATE_SAVING

Repeated cookie query or Storing in viewstate? Which is the better practice?

左心房为你撑大大i 提交于 2019-12-02 12:03:34
问题 I have a internal website that users log into. This data is saved as a cookie. From there the users go on their merry way. Every so often the application(s) will query the authentication record to determine what permissions the user has. My question is this: Is it more efficent to just query the cookie for the user data when it is needed or to save the user information in viewstate? [Edit] As mentioned below, Session is also an option. 回答1: Viewstate is specific to the page they are viewing,

Repeated cookie query or Storing in viewstate? Which is the better practice?

别等时光非礼了梦想. 提交于 2019-12-02 05:15:34
I have a internal website that users log into. This data is saved as a cookie. From there the users go on their merry way. Every so often the application(s) will query the authentication record to determine what permissions the user has. My question is this: Is it more efficent to just query the cookie for the user data when it is needed or to save the user information in viewstate? [Edit] As mentioned below, Session is also an option. Viewstate is specific to the page they are viewing, so its gone once they go along thier merry way. Not a good way to persist data. Your best bet is to use

ViewStateUserKey + shared hosting + ViewStateMac validation failure

本小妞迷上赌 提交于 2019-12-02 03:51:19
问题 So, the question is simple, even though I'm starting to have doubts if this will get answered... I have a website, where I wanted to secure my viewstate with the recommended ViewStateUserKey.. In my base page (inherited from Page obviously) I have this code: protected override void OnInit(EventArgs e) { base.OnInit(e); if (User.Identity.IsAuthenticated) base.ViewStateUserKey = Session.SessionID; } Works good on localhost, however, when I upload it to hosting (shared hosting provided by one of

ASP.NET: Why control state cannot be disabled

最后都变了- 提交于 2019-12-02 03:38:05
问题 I know ASP.NET doesn't allow to disable control state. Does anybody know why ? I've googled a lot but only saw it is not possible, but was not able to find "WHY?" Any thoughts on this would be welcome! P.S. In my particular case I need to put a lot of items into a dropdown list that will NOT be used for server side events. Instead of just disabling control state I need to write my own custom DropDownList... :( 回答1: Control state was separated from view state so that view state could be

Dynamically adding controls to ASP.NET - viewstate is not retained after 20 minutes

笑着哭i 提交于 2019-12-02 03:15:40
We have a ASP.net form [.NET 3.5 on IIS 6] that loads controls dynamically. We are able to retain the values in the viewstate as long as the postback happens within 20 minutes . The database also gets updated properly. Everything works as expected. However, If it takes more than 20 minutes for a user to fill out the form, the controls no longer retain their values during postbacks. The session values are intact, the user authentication is also intact. We tried several things 1) Added machine keys to web.config files - we have 2 web servers load balanced by Windows load balancer 2) We confirmed

ViewStateUserKey + shared hosting + ViewStateMac validation failure

99封情书 提交于 2019-12-02 01:47:05
So, the question is simple, even though I'm starting to have doubts if this will get answered... I have a website, where I wanted to secure my viewstate with the recommended ViewStateUserKey.. In my base page (inherited from Page obviously) I have this code: protected override void OnInit(EventArgs e) { base.OnInit(e); if (User.Identity.IsAuthenticated) base.ViewStateUserKey = Session.SessionID; } Works good on localhost, however, when I upload it to hosting (shared hosting provided by one of our local providers), it gives the traditional "Validation of viewstate MAC failed" error after I

ASP.NET: Why control state cannot be disabled

强颜欢笑 提交于 2019-12-02 01:24:44
I know ASP.NET doesn't allow to disable control state. Does anybody know why ? I've googled a lot but only saw it is not possible, but was not able to find "WHY?" Any thoughts on this would be welcome! P.S. In my particular case I need to put a lot of items into a dropdown list that will NOT be used for server side events. Instead of just disabling control state I need to write my own custom DropDownList... :( Control state was separated from view state so that view state could be disabled without breaking critical functionality. In theory, control state should contain everything necessary for

Gridview ControlState very large even when viewstate disabled and not using DataKeyNames

纵然是瞬间 提交于 2019-12-01 20:27:38
I have an asp:Gridview bound to an asp:ObjectDataSource. I have disabled the ViewState on the GridView, and have not set the DataKeyNames property. I have about 10 BoundFields and a few TemplateFields. These TemplateFields are not bound to server controls but to an anchor tag or to an img tag. However, at runtime, when I switch on page tracing I see that the ControlState of the Gridview varies between 7 and 12K for displaying just 14 rows of data. (View source on the rendered page also gives a same long string in the __VIEWSTATE hidden field). I do not understand why this happens as I have

Dynamically created DropDownList loses ListItems on Postback

删除回忆录丶 提交于 2019-12-01 16:42:10
I have a page that contains some dynamically created controls (TextBox and DropDownList). When a postback occurs, the TextBoxes keep their values, but the DropDownLists lose their ListItems. This is quite confusing, since the page level DropDownList also keeps its ListItems. Can anyone see what's wrong with the code below? Any help in solving this issue would be greatly appreciated. <%@ Page Language="VB"%> <script runat="server"> Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) If Not Page.IsPostBack Then ddlFixed.Items.Add(New ListItem("12", "13")) ddlFixed.Items