viewstate

"Padding is Invalid and cannot be removed" exception on WebResource.axd

I have an ASP.NET 2.0 application that is working fine in our local environment. When published to a test server, we're getting intermittent errors on the server. Here's the most common: Padding is invalid and cannot be removed. Description: An unhandled exception occurred during the execution of the current web request. Please review...

ViewState, FormView, and Controls

How do you (in Visual Studio) compare the controls in the different templates in a formview so you can track down a ViewState error? ...

Strange Error in .net Application. - RijndaelManaged..

During a recent load test, I've been getting some strange "Index Out of Range Exception" Stack trace: at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast) at System.Security....

Validation of viewstate MAC failed. asp.net 2.0

Hello everyone, I am currently receiving the below error: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. I have found multiple solutions to this error. The solutio...

selectedIndex is lost during postbacks - ASP.NET

I have a list box control: <asp:ListBox runat="server" id="lbox" autoPostBack="true" /> The code behind resembles: private void Page_Load(object sender, System.EventArgs e) { lbox.SelectedIndexChanged+=new EventHandler(lbox_SelectedIndexChanged); if(!Page.IsPostBack) { LoadData(); } } private LoadData()...

asp.net viewstate encryption

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 viewStateEncryp...

ViewState decoding failure when client connects via multiple IP's per request

We have a semi-weird issue for our site. Consistently, from 1 anonymous* user the following error occurs: Exception type: System.FormatException Exception message: Invalid length for a Base-64 char array. After some investigation, it appears the user is using some form of load-balancing firewall, as the IIS logs shows the r...

Failed to load viewstate when dynamically loading different controls

I have an aspx page which is loading some controls dynamically on postback (ie when a click event happens) and adding them to a placeholder. Depending on what is clicked a different set of controls needs to be loaded. This works perfectly the first time, but when I clear the placeholder's controls and attempt to dynamically load a diffe...

ASP.NET ViewState postback with page refresh and bookmarks

The ASP.NET ViewState feature can sometimes be a double edged sword. I rely on it on most of my projects and it speeds up development considerably. My problem is that sometimes users will try to refresh a page which will cause the viewstate to be lost, other times the user might want to bookmark a page but when the get back the viewstat...

Inconsistent behavior with AJAX and ViewState in .NET

I'm finding that hitting the "Refresh" button on my browser will temporarily screw up the ViewState for controls inside an UpdatePanel. Here's my situation : I made a custom WebControl that stores values in the ViewState. I put this control inside an UpdatePanel. When I hit the "refresh" button on my browser, it will temporarily wipe ...

SQL Login failed when enableviewstate = false

Good day, I'm having a problem with asp.net 2.0 viewstate. Basically, I want to disable the viewstate for a gridview. However, when I do so, as soon as there is a post-back, before even getting into Page_Load, I get a 'Login failed for user sa ...'. If I enable the viewstate back, everything runs smoothly. In PageLoad, I set the conn...

Binding gridviews to viewstate until being able to write to database

I recently began working on a project which has many gridviews on a single page. During creation of a new record, the user needs to be able to add/remove/edit these gridviews and then save to the database at the end. The problem with this obviously is that there is no datasource to bind the data too until after its written to the databas...

Can't get ViewState to work on production server.

I have an ASP.NET application developed on my Vista box (IIS7). It works fine until I deploy it to the product server (W2K3/IIS6). Once deployed, I get a consistent "Object reference not set to an instance of an object." when reading from my ViewState object that determines whether a button displays an "On" or "Off" image. The code for ...

How to persist List<T> property in ASP.NET Custom Control?

I have the following property in a custom control: List<myClass> _items; public List<myClass> Items{ get { return _items; } set { _items= value; } } In my codebehind, I add items to the collection as in... myCustomControl.items.Add(new myClass()); However, these are not persisted across postbacks. What is the proper way to...

How to create a Generic StateManagedCollection?

One example is described here. But the author apparently forgot to include the code for download. Another example is shown here. However, this one doesn't quite work (as described in comments). How do you do this correctly? ...

ASP.NET 2.0 RijndaelManaged encryption algorithm vs. FIPS

I'm running into an issue with an ASP.NET 2.0 application. Our network folks just upped our security, and now I get the floowing error whenever I try to access the app: "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms." I've done a little research, and it sounds like ASP.NET uses the...

ASP.NET Viewstate validation - ASP.NET 1.1 vs. ASP.NET 3.5

Hi all, we're in the process of migrating our web app from ASP.NET 1.1 to ASP.NET 3.5. Our app runs on multiple servers through DNS round robin, so every browser request may end up on a different server. We do have a in our web.config to prevent validation errors. However, our plan was to migrate one server at a time. Now it looks lik...

How do I upload a file from a dynamically created FileUpload control with ASP.NET?

In my code attached below, I'm trying to upload a file via ASP.NET. I am dynamically creating the FileUpload control so that means it's not in my ViewState which (I think) means I can't use the control for uploading files unless I use the old fashioned multipat/form-data way which I don't want to do. I need to be able to allow the user...

ViewState object lost in Master Page Load

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. ...

ASP .NET 2.0 Control State vs ViewState

Is the new ControlState feature only applicable to custom controls or is it available for the standard server controls as well? That is..can you disable ViewState for an entire page with standard controls like Detailsview, Gridview and would it still work? Does ControlState apply to standard server controls? Or in order to work with Co...