viewstate

Reusing ViewState value in other session (CSRF)

北慕城南 提交于 2019-11-30 05:31:05
问题 I'm using a *myfaces-api-2.2.3 with javax.faces.STATE_SAVING_METHOD set to client , I got the following scenario, 1) User X logs into the system and adds user XXX (using jsf f:ajax action) , while inspecting the chrome dev tools you can see the form that being submitted along with the ViewState value. 2) Copy that ViewState value (from chrome dev tools --> network tab) --> place it into html file with form (that mimics my original add user X ) 3) Logout from user X session (session being

How do I turn off viewstate for good?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 05:08:57
Coming from a PHP background I love using clean URLs to grab data from one service to another. However, on some of my ASP.NET projects I get the horrible ViewState parameter in my URLs. Is there a way to turn this off globally? What affect will this have on my ASP.NET app? You can turn off viewstate for the whole site like this: <system.web> <pages enableViewState="false" /> That said, you shouldn't be getting it on the url. ViewState is a hidden field that is sent to the server with a postback (which normally uses post). It keeps the state of the controls when the page was rendered to the

User control (ascx) and properties

江枫思渺然 提交于 2019-11-30 04:44:09
The only way I've found to persist property values within a user control is to use the ViewState. public string Title { get { return Convert.ToString(ViewState["Title"]); } set { ViewState["Title"] = value; } } I can't say I'm real impressed with this though, as the more properties a user control has the more crap you'll be sticking in the ViewState. Is there a better way to persist properties? Sayed Ibrahim Hashimi It depends. If you need to property values to be persisted beyond a post-back then you'll either have to use ViewState or Session. Since those controls are re-created on each post

ASP.NET MVC and ViewState

帅比萌擦擦* 提交于 2019-11-30 01:55:06
Now I've seen some questions like this, but it's not exactly what I want to ask, so for all those screaming duplicate, I apologize :). I've barely touched ASP.NET MVC but from what I understand there is no ViewState/ControlState... fine. So my question is what is the alternative to retaining a control's state? Do we go back to old school ASP where we might simulate what ASP.NET ViewState/ControlState does by creating hidden form inputs with the control's state, or with MVC, do we just assume AJAX always and retain all state client-side and make AJAX calls to update? This question has some

How to minimize viewstate size of a page in asp.net?

浪尽此生 提交于 2019-11-30 01:32:34
How to minimize viewstate size of a page in asp.net? Please help. You have several options to reduce the ViewState: Disable ViewState for controls that do not need it (this is the most effective solution). E.g. if you can cache some data on the server, then you can re-bind any databound controls with every request and it's not needed to save everything in ViewState. Turn on HTTP compression on the server (IIS) . This reduces the size of the page sent to the client, including the ViewState. Compress the ViewState . This has an additional advantage over HTTP compression: it also reduces the size

Why would you ever use asp.net's ViewState storage object over the Session storage object?

雨燕双飞 提交于 2019-11-29 21:05:51
Other than because session storage is session-global to more than one page, why would you ever want to use the viewstate to hold values? It seems kind of ridiculous to send any kind of information other than a few small query string like values, back and forth from the client to server. I mean what a waste of bandwidth(!), simply for storage purposes. The session, while global across multiple pages, seems like a completely superior alternative to the viewstate. Especially with asp.net ajax controls and variants, the viewstate could quickly become bloated tracking the various states and

In ASP.Net, during which page lifecycle event does viewstate get loaded?

时光怂恿深爱的人放手 提交于 2019-11-29 20:19:57
I know it happens sometime before Load, but during what event exactly? It's loaded into memory between init and load. See t his article for a full break down of the page lifecycle. I once got into this question too and got my answer from TRULY understanding Viewstate article, which I highly recommend. After reading it I designed a graphic that helped me to understand better what was happening on between each stage and when and how ViewState was doing its job. I'd like to share this graphic with other people that (like myself) need to see how stuff work in a more visual way. Hope it helps! :)

How can I take more control in ASP.NET?

假如想象 提交于 2019-11-29 19:01:55
I'm trying to build a very, very simple "micro-webapp" which I suspect will be of interest to a few Stack Overflow'rs if I ever get it done. I'm hosting it on my C# in Depth site, which is vanilla ASP.NET 3.5 (i.e. not MVC). The flow is very simple: If a user enters the app with a URL which doesn't specify all the parameters (or if any of them are invalid) I want to just display the user input controls. (There are only two.) If a user enters the app with a URL which does have all the required parameters, I want to display the results and the input controls (so they can change the parameters)

How to disable ViewState for a .aspx page?

让人想犯罪 __ 提交于 2019-11-29 16:58:22
问题 I need to completely disable ViewState for a .aspx page inside my web application. I have gone through different blogs and what I understand is that we must set <%@ Page EnableViewState="false" ...%> , but this is not working. Is this enough to disable ViewState for all the controls inside the page? Or should I make any additional modifications? If so, please specify them. I don't want the ViewState enabled for even a single control inside the .aspx page 回答1: I think the quotes should be:

How do you serialize javascript objects with methods using JSON?

一个人想着一个人 提交于 2019-11-29 16:31:15
I am looking for an enhancement to JSON that will also serialize methods. I have an object that acts as a collection of objects, and would like to serialize the methods of the collection object as well. So far I've located ClassyJSON . Any thoughts? Staale I don't think serializing methods is ever a good idea. If you intend to run the code serverside, you open yourself to attacks. If you want to run it client side, you are better off just the local methods, possibly referencing the name of the method you are going to use in the serialized objects. I do believe though that "f = "+function() {}