viewstate

ViewState object lost in Master Page Load

…衆ロ難τιáo~ 提交于 2019-12-06 02:30:20
问题 I am assigning ViewState["something"] in Page Load of content page and when I try to access the ViewState variable in Master Page Load event handler, the viewstate variable is lost.Can anyone guide me why this is happening and the solution. 回答1: Master pages and content pages do not share the same ViewState. If you are trying to pass something from the content page to the master page there are a couple of alternatives: - use this.Context.Items that is common to the entire site during an HTTP

Invalid character in a base-64 string - ViewState?

时光毁灭记忆、已成空白 提交于 2019-12-06 01:04:32
Web application is throwing a handful of these errors everyday. Exception: System.FormatException: Invalid character in a Base-64 string. at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) at System.Web.UI.HiddenFieldPageStatePersister.Load() I think the error's coming from decoding the ViewState, but I'm having trouble just triggering the error. I've never been able to trigger the error in dev, only prod. And even in prod, I can't

Detecting viewstate tampering

蓝咒 提交于 2019-12-05 23:07:45
It has been seen in my asp.net project that the viewstate has changed. Is there anyway to check whether my ViewState has been tampered with? (ideally with C#) The viewstate is signed with a machinekey (default servers mac) however if it's just the error you get then it could be a transmission error or similar (also if your running a farm make sure to set the same machine key on all machines) Also if your after security don't store sensetive information in the viewstate, save it in the session instead. You could add an encrypted checksum in the ViewState, and check whether it is still correct

Primefaces datatable selected row not working using viewscope

拟墨画扇 提交于 2019-12-05 21:42:40
I am using JSF 2.0 and Primefaces 3.4.2, I have a datatable populated using lazy load. When I view scope for managedbean, then datatable selectedRow gives null pointer exception. If I use session scope then I could get selectedRow in managedbean. I am using CDI Spring annotations for specifying scope. I have used this method to create view scope. Update 1 I have noticed another thing is using view scope when I paginate to second page and then comes back to first page, then I could get the selectedRow. If I select a row without paginating then I get null pointer exception. JSF Page <p:dataTable

How to store an object in the viewstate?

爱⌒轻易说出口 提交于 2019-12-05 19:16:18
I am using EWS to develop my email client. I found that if I store ItemId in viewstate it will cause an exception says: Type 'Microsoft.Exchange.WebServices.Data.ItemId' in Assembly 'Microsoft.Exchange.WebServices, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable. If I store ItemId as string like: ViewState["itemId"] = id.ToString(); and then try to cast back, ItemId id = (ItemId)ViewState["itemId"]; it says I can not convert from string to ItemId . Any idea? As the error message suggests, you can't store an object in viewstate unless it's

asp.net viewstate encryption

本小妞迷上赌 提交于 2019-12-05 17:10:08
问题 I have a few questions about when and how viewstate is encrypted in asp.net 3.5. For instance, if I have a machinekey entry in my web.config like: decryptionKey="AutoGenerate,IsolateApps" validation="AES" decryption="Auto" /> Is viewstate encrypted at this point? Or do I need to specify the viewStateEncryptionMode in the page section also? Also, is it possible to encrypt a formsauthentication cookie, but not encrypt viewstate at the same time? Thanks for any help. 回答1: The controls on the

Sensitive data in Viewstate?

∥☆過路亽.° 提交于 2019-12-05 15:53:12
I need to store sensitive data across few pages (run over https) per session. I can't use session object, for the primary reason being that the session store is designed as just as backup store (primarily make service calls and load the session). If the session has been restarted or in other words that the key in the session does not exist, make the service and re-populate the session. So, in the case of user keyed in sensitive data, i need to carry this data forward across pages, we do not have a persistent store for now, therefore option left is storing these sensitive data in Viewstate. 1)

When is safe to disable viewstate?

隐身守侯 提交于 2019-12-05 10:30:56
When is safe to disable viewstate? For wich controls? Under what circunstamces? In a user control I have disabled viewstate, but if I attempt to click in this control <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" OnClientClick="return confirm('¿Está seguro que desea eliminar el mensaje?');" EnableViewState="true"> <asp:Image ID="ImageButton1" runat="server" ImageUrl="~/Content/Images/delete.png" ToolTip="Eliminar mensaje" /> Eliminar </asp:LinkButton> I get an System.InvalidOperationException exception. It is inside a ListView. Most controls behave as you would expect

Which types of objects can we place in view state?

寵の児 提交于 2019-12-05 09:26:45
I want to know why we must set the serializable attribute to save an object in view state. Also, which type of objects can we store in view state? ViewState is serialized using binary serialization using ObjectStateFormatter . Quote from the documentation: The ObjectStateFormatter class is optimized to serialize and format many common .NET Framework reference types, as well as constants. The following table lists the types that are optimized. Array, DateTime, Int16, String, ArrayList, Double, Int32, String [], Boolean, Enum, null (Nothing), String.Empty, Byte, Hashtable, Pair, Triplet, Char,

ASP.NET custom control: when is LoadPostData() called?

我们两清 提交于 2019-12-05 04:48:38
I have developed a custom control that extends ListBox. The idea is that the control 'remembers' modifications to its elements which occurred client-side, e.g. as a result of an AJAX request. The way it works is that the control also renders a hidden input, and the result of the AJAX request is stored in the hidden input. This is posted back, and the control's LoadPostData() method looks for the hidden input, and if the hidden input has data, creates the ListItem collection from it. This works perfectly so long as the user has made a selection from the list box . If they have not, the