w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Viewstate verification failed. Reason: The viewstate supplied failed integrity check.
You can check if the problem is into the machine authentication code(MAC). Set enableViewStateMac="false". If you no longer get view state errors, the problem is related to the MAC feature. Also you can generate a new machineKey and copy it into the web.config of your app on each server. Here are some links that might help... explanation of machineKey http://msdn2.microsoft.com/en-us/library/w8h3skw9.aspx machineKey generator http://www.codeproject.com/aspnet/machineKey.asp

Categories : Asp Net

Select all fields where fieldone is not equal to null + Propel
I don't know propel. But the proper SQL syntax for the expression would be: $locations = LocationQuery::create()->where('location is not null')->find(); Any comparison to NULL in SQL returns NULL, which is treated as false. With the exception of is null and is not null.

Categories : PHP

While loop warns of always true since value of type 'int' is never equal to 'null' of type 'int'
while (upload.Peek() != null) ...looks suspicious since StreamReader.Peek() can't return null. I suspect the correct line would be; while (upload.Peek() != -1) Return Value Type: System.Int32 An integer representing the next character to be read, or -1 if there are no characters to be read or if the stream does not support seeking.

Categories : C#

When comparing two equal integers in while loop, the equal-to operator fails?
You will want to use .equals() to compare the value of two objects. Anytime you use == it will compare instances of objects. .equals() is a method inherited from Object and is used to compare the values of objects.

Categories : Java

javascript object comparison: equal vs strict equal
Simple comparison of user-defined objects (I assume you're asking about them and not about primitives such as string and Numbers), never returns true, so there is no point using it. You can check whether two objects are of the same type by comparing their prototypes and constructors, but then again it is indifferent wheter you use == or ===. The only difference is that the comparison may return true. But this of course does not say anything about the properties of an instance, two instances with the same prototype and constructor may have different properties function cat1 () { this.name = "blacky"; this.age = 9; } function cat2 () { this.name = "blacky"; this.age = 9; } var anton = new cat1() var john = new cat2() var kevin = new cat1() console.log(anton == kevin)

Categories : Javascript

ViewState in the ASP.NET, does it really go away?
It's because you are using aspx pages in MVC project. (In the screenshot I can see ViewMaps.aspx) Aspx pages are webforms. Webforms have viewstate. If use use the proper Controllers and Views, you will not see any viewstate. Just because the project is MVC doesn't mean that viewstate will not be present on aspx pages. Also, people generally don't use aspx pages in MVC projects.

Categories : C#

python return equal where the string is not actually equal?
You probably don't want to use sort() to flip a list. The sorting that takes place entirely depends on the string (it varies on the first letter of each string). You can use .reverse to reverse a list: def Isequal(m,n): m = m.split(',') m.reverse() if m == n.split(','): print "Equal" else: print m, n If you want to sort the list in place, you can always do .reverse() instead of .sort() If reversing the list was just an example in your question, and your strings would actually have more items when you split them, you can use sets: def Isequal(m,n): if not set(m.split(',')).symmetric_difference(n.split(',')): print "Equal" else: print m, n By the way, Sparse is better than dense.. The semi-colons are rather... ugly.

Categories : Python

Disable ViewState in ASP.net
You can find a very good explanation here, http://www.codeproject.com/Articles/31344/Beginner-s-Guide-To-View-State You can disable a view state for a control as below, TextBox1.EnableViewState =false;

Categories : C#

Controls that don't have ViewState
Every control has ViewState because that is where all attribute values are stored. To avoid ViewState you can disable it on the control (EnableViewState=false) and make sure when you set any properties (like Text, Visible etc.) you do that yourself on every postback (so that ViewState is not needed) - so in events like Page_Load instead of Button_Click.

Categories : Asp Net

Invalid ViewState only in IE 10
Not sure if this will help, but this is the additional section we have in our ie.browser: <browser id="IE5to9" parentID="IE"> <identification> <capability name="majorversion" match="^[5-9]|[1-9]d+" /> </identification> <capture> </capture> <capabilities> <capability name="activexcontrols" value="true" /> <capability name="backgroundsounds" value="true" /> <capability name="cookies" value="true" /> <capability name="css1" value="true" /> <capability name="css2" value="true" /> <capability name="ecmascriptversion" value="1.2" /> <capability name="frames" value="t

Categories : C#

Viewstate and Tab container
Here's what I'd do: Wrap the following code: Button btn = new Button(); btn.ID = "Add" + nextTab.ToString(); btn.Text = "Add"; btn.Click += new EventHandler(add_Click); TabPanel t = new TabPanel(); t.ID = "Tab" + nextTab; t.HeaderText = "Tab:" + nextTab; t.Controls.Add(btn); TabContainer1.Tabs.Add(t); Into its own method called RenderDynamicTabs(int nextTab) At the end of add_Click, add this code: if(null == ViewState["NumDynamicControls"]) { ViewState["NumDynamicControls"] = 0; } var dynamicControlCount = int.Parse(ViewState["NumDynamicControls"]); dynamicControlCount++; In Page_Load, add the following: if(null != ViewState["NumDynamicControls"]) { // There are controls that need to be re-generated

Categories : Asp Net

Set a ViewState using JQuery
Try to add AutoPostBack="True" in you TextBox. This will call the OnTextChanged event. <asp:TextBox ID="currentIndexTexBox" runat="server" OnTextChanged="CurrentIndexTextBoxOnTextChanged()" AutoPostBack="True"></asp:TextBox>

Categories : C#

PostBack and ViewState
Because ViewState is a Dictionary Object (StateBag) No exception is thrown if you attempt to get a value out of view state that does not exist. To be sure that the value you want is in view state you would do what you are asking about. Also, if you are developing a control or shared component that will be used on page that has ViewState disabled ViewState will be null for ViewState values. Bits of this were taken from: http://msdn.microsoft.com/en-us/library/ms228048%28v=vs.85%29.aspx

Categories : C#

Ajax invalidating viewstate
Well, I got it to work, but I'm abandoning the .NET menu anyway. Since I was looking for some high level information, I will let the community what I was able to do... The viewstate issue happens when I load the AJAX page then navigate using the menu. It happens because clicking the menu posts back to my AJAX page before it navigates away. If it were just a hyperlink, there would be no issue. The AJAX page in question is essentially 3 divs. Div_A is a navigation element consisting of a list of documents. Div_B is a read only detail of 1 document w/ some action buttons. Div_C is an input form. The divs are populated by jQUery ajax calls. On success, I replace the entire innerHTML of the DIV in question. Div_A & Div_B are automatically populated at page load in that order. (List

Categories : Jquery

c# - How to store ArrayList in ViewState?
As the error sais System.Data.DataRow is not serializable so you can not store it in ViewState. I would suggest that you make a custom class that is marked as Serializable that contains all the values you need and save an ArrayList of those objects in the ViewState. You would populate these objects in your foreach loop with data from DataRow. Example: The data object [Serializable] public class Employee { public int emp_id, public string emp_name, //other properties } In your bindGridView method //other code ArrayList arrList = new ArrayList(); foreach (DataRow dtRow in dsemer.Tables[0].Rows) { arrList.Add(new Employee { emp_id = dtRow[0], emp_name = dtRow[1], //other properties }; } ViewState["ds"] = arrList;

Categories : C#

How to save a dictionary value in a viewstate?
You do not need to update the ViewState in page load, because it has not changed yet, so remove the assignment of ViewState in your Page_Load and do this instead: protected void Page_Load(object sender, EventArgs e) { // Only read the value from ViewState, do not update it here Answers = (Dictionary<String, String>)ViewState["Answers"]; } Now in you event handler, when you are done adding to the Answers, then you should update your ViewState value, like this: protected void rdb_study_popul_SelectedIndexChanged(object sender, EventArgs e) { ViewState["StudySamplepopulation"] = rdb_study_popul.SelectedValue.ToString(); Answers.Add("StudyPopulation", ViewState["StudySamplepopulation"].ToString()); // Now that you are done altering the Answers, save the updated

Categories : Asp Net

Set asp:ImageButton ViewState from javascript
You shouldn't set viewstate from javascript - viewstate is meant to persist server state, also if you have decent security settings it is encrypted and has got hash signature. If you need something from client for server, make a hidden field next to button and set the hidden field value instead.

Categories : Javascript

Property in viewstate different on one page to another
Using ViewState in this manner is a brittle solution, because ViewState is not intended to exist outside of the scope of the page it was initiated in, much less passed between pages, which I realize you are not quite doing, but you are getting dangerously close to doing it. The better approach is to use Session cache, as it was intended to exist per user and span multiple page requests. Try this: To store in Session, do this: Session("PaymentOnHold") = [Date].Now.ToString("yyyyMMddHHmmss") To retrieve a value from Session, do this: ' First check to see if the value is in Session cache or not If Session("PaymentOnHold") IsNot Nothing Then ' Everything in Session cache is stored as an object so you need to cast it to get it out Dim datePaymentOnHold As DateTime = TryCast(Sessi

Categories : Asp Net

Strange behaviour of ViewState
I don't want to say a wrong thing, but, reading from documentation, it was written that "Viewstate is used to preserve page and control values between round trips" http://msdn.microsoft.com/en-us/library/ms178198(v=vs.85).aspx Have you tried to put the URLs in variables, and then assigning to ViewState["imgX"], and try to do another Postback and see if the ViewState["imgX"] contains the URL?

Categories : C#

Security issues on viewstate
Hard to say without more information, but here are a few random guesses: ViewStateEncryptionMode can't be set to true?? I guess you mean 'Always', MSDN reference If ViewStateEncryptionMode is Always, yes your viewstate is encrypted. This should hide the information it contains from prying eyes. If you don't need to hide the viewstate content, but want to prevent tampering (i.e. modification) you can set enableViewStateMac='true'. This adds a cryptographic hash to check if the content was tampered with. See MSDN documentation for more details. Both this and ViewStateEncryptionMode can be active at the same time if you want to. Most probably you are seeing a false positive from OWASP ZAP. Does your encoded viewstate contain strings such as SQL, JDBC or ODBC? See this bug. The message remin

Categories : C#

Use of Literal vs GenericHtmlControl and viewstate reduction
I would also consider creating your own custom control, which would be very easy to do. You could do: public class MyLiteral : WebControl { public string Text { get; set; } protected override void Render(HtmlTextWriter writer) { writer.Write(this.Text); } } Since the functionality is pretty simple, this is a flexible solution because it gives you more global access to all the texts. For instance, later if you realize you wanted bold text, you don't have to update all of the markup of the controls, you can change your custom class. There are a lot of benefits to doing it this way. All you need to do is add a refernce to the namespace/assembly within the <pages> element of the configuration file (with a tagPrefix of c), and change the markup to: <c

Categories : Asp Net

List in viewstate not marked as serializable
I believe the error is pointing to ListItem not being serializable. You won't be able to fix that, but you can create your own MyListItem class that is decorated with the [Serializable] attribute. What I'd suggest as a better way is to investigate why you need to store a list of ListItems in ViewState instead of just binding it to the control that is storing that list.

Categories : Asp Net

Why does DropDownList.SelectedValue is relied on viewstate?
The SelectedValue relies on ViewState because on PostBack it rebuilds its ListItems from the ViewState and then sets the selected value on the DropDownList from the Request Object. It is not taking the Request value as the SelectedValue directly. This in turn is because, ASP.Net can check if the posted DropDownList has not been tampered with at the client. It does so by first de-serializing the original items from the ViewState. It then finds the Request Value in the items and sets its Selected property as true. Only now, the SelectedValue property is available. (or SelectedIndex for that matter). It should be able to fire a SelectedIndexChanged event now. This is also the reason that you do not need to bind the DropDownList again in PageLoad. The list items are automagically retreived

Categories : Asp Net

"Validation of viewstate MAC failed" with Kentico 7.0 and IIS 7.5
Are the Kentico instances set into the Web farm synchronization so they know about each other and all the things including cache and viewstate are synchronized?

Categories : Asp Net

ASP.NET Validation of viewstate MAC failed - IIS recycled
The Machine Static Key is a fix only for the Web Farm scenario. The key on the browser must match the key on the server to avoid this error. When a customer visits a site on a web farm, they may start on server A and have that key stored client-side, but on the postback be hitting server B. In this case, server B would balk, unless both server A and server B are configured with the same key. In your case, with the app pool recycling, this isn't a potential fix. Like you, our team has a central error logging system, and we use a global error handler in the global.asax. W e have a web interface that we can use to review the errors. We have a similar issue - we get these errors, too, and others that aren't really worth noting, but they get logged anyway. We simply log our errors diff

Categories : Dotnet

Should i make a call to DB or save value in viewstate
If you can save it in viewstate then go for it. But there are plenty of storage options in addition to just viewstate: querystring (good for Ids, not great for strings) cookie (pretty straight forward) local storage (HTML 5 only) cache (you could still appear to make the call but just have the results cached. you then have to deal with cache expiration as well) session (as you mentioned, this is basically a per-person cache usage, but is not a bad option) hidden field (basically what viewstate is) Even with all of those options, the viewstate is going to be a pretty good one, but it just requires that you post back the viewstate every time you need that value.

Categories : Asp Net

How to get a stored Dictionary from the viewstate
From your code, groupByCountDictionary is not a dictionary, it is a IEnumerable<anonymous_type>. You can rewrite your LINQ code to use .ToDictionary(...) method that will return the object you expect.

Categories : C#

Modifying item in viewstate - is it safe to do?
Kind of subjective, but I don't see anything wrong with this by practice. This is something that happens all the time within different form controls on the page. The controls will edit viewstate information pertaining to themselves and persist that over postback. The reason the list changes in the viewstate when you modify it after adding it to the viewstate is that it doesn't get immediately serialized. The list is passed by reference to the viewstate collection where it sits until the page serializes the viewstate shortly before completing the request.

Categories : Asp Net

c++11 speed comparison/cost std::hash equal versus std::string equal directly on 2 large strings
std::hash<std::string>(largeString1) == std::hash<std::string>(largeString2) Will be far slower than largeString1 == largeString2 Hashing a string involve iterating over the entire length of it. So the hash comparison requires the code to iterate the full length of both strings one at a time and run them through complex equations. The straight equality code simply iterates them at the same time and immediately quits the instant it finds a difference. Trust the library. If == could be done faster, they would have done it faster. If you're going to be comparing each string many times, then hashing ahead of time once and comparing just the hashes may be faster, but you would still have to confirm matches since comparing hashes can give false positives. It only makes t

Categories : C++

'Greater than or equal' and 'less than or equal' CODEIGNITER
Change =< to <=. I also tested your current query in phpmyadmin, because i could not believe that it does not throw an error. But mine does it. So your query should not work in phpmyadmin. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=< ...' at line ...

Categories : PHP

Equal strings are not equal in Perl
When a string is interpolated as a regex, it isn't matched literally, but interpreted as a regex. This is useful to build complex regexes, e.g. my @animals = qw/ cat dog goldfish /; my $animal_re = join "|", @animals; say "The $thing is an animal" if $thing =~ /$animal_re/i; In the string $animal_re, the | is treated as a regex metacharacter. Other metacharacters are e.g. (...), which is a capture group. This is present in your $List. That is, your regex is actually looking for the string SQL Server C4 and capturing the C4 when successful. To deactivate metacharacters, you can quote them like /Q$metacharsE/ In your case: $test = defined($o_noreg) ? $descr_d eq $List : $descr_d =~ /Q$List/i; As an aside, Perl's default false value is the empty string. Your output may

Categories : Regex

Validation of viewstate MAC failed - Checkout form
This error can be caused by many different factors. Here is a link to the Microsoft article about this issue. What usually works for me is generating a machine key and adding it to the web.config. Here is a tutorial on how to do that. Also, you really shouldn't be disabling viewstate mac, especially in an e-commerce application.

Categories : C#

How to determine if ViewState has MAC enabled when crawling a page?
ViewStates are basically BASE64 encoded strings. So what you can do is try to decode them with a BASE64 decoder. If it's encrypted you will get some binary content which is not really readable. If no encryption is used you will be able to see the contents. For instance Fiddler2 can assist you in decoding ViewStates in your browser. Now there is also the option of using a MAC: If the viewstate has its MAC enabled then there The security of this system lies in the secrecy of the secret key value. This value is always stored on the server, either in memory or in a configuration file (more on this later)—it is never written to the page. Without knowing the key, there would be no way for an attacker to compute a valid view state hash. from MSDN "View State Security". You ca

Categories : Asp Net

Deserialize viewstate string after Page.ViewStateUserKey is set
You'll need to use the same PageStatePersister instance that the Page itself uses. Otherwise this check won't work reliably. For example, consider this instance method in your Page's code-behind: private void CheckCsrfToken() { var persister = this.PageStatePersister; persister.Load(); if (persister.ViewState == null) { throw new Exception("Validation failed."); } } As long as Page.ViewStateUserKey is already set, the returned persister instance will have its modifier also set appropriately.

Categories : Asp Net

How to store Data from static WebMethods into the ViewState
ViewState is a property of the page, which runs through the ASP.NET WebForms page lifecycle. Using WebMethods with AJAX skips the entire page lifecycle, and skips ViewState altogether. So you won't be able to use ViewState the way you're looking. In order to use AJAX and still have access to all the WebForms stuff like ViewState and control properties, you need to use UpdatePanels. You'll need to find alternatives - for example, instead of ViewState, you can put things into hidden fields, then use javascript to read and populate those hidden fields. If you do this, you can read and write to these fields from both the javascript and ASP.NET worlds.

Categories : C#

fake http post request - viewstate
If you can "fake" signed/encrypted data you don't really need to deal with fake posts - just steal all SSL traffic :). View state comes in original response for the page encrypted - so you simply need to parse original response (use Html Agility Pack) and send that view state back in post request.

Categories : C#

ASP.NET Dynamically load controls based on ViewState
As pointed at msdn http://msdn.microsoft.com/en-us/library/ms178472(VS.100).aspx ; you may use InitComplete event to get access viewstate data.But some times viewstate data gets bigger and makes performance problem overall .Alternatively you may use session object or a unvisisble controle to store your data.

Categories : C#

How do I serialize a system type so I can store in viewstate?
A list is serializable if the generic type is serializable. You should make the generic object and sub objects in your list serializable. Add the [Serializable] tag to these objects.

Categories : C#

does storing Data in ViewState slows down the page load?
If you're storing a large amount of data in ViewState, you'll notice performance issues. Although ViewState is really meant for a "this page only" and Session is meant for "this session", you'll reach a limit with ViewState size where the Session is ultimately much better for performance. It's worth noting that you might be having some other type of issue, not just an issue with the ViewState (i.e. your database query may be taking a long time and could possibly be cached).

Categories : C#

ViewState on programmatically loaded usercontrols (restored after Page_Load)
Try the EnableViewState="true" attribure on txtTest as well as on your custom user control when creating it : . . c.EnableViewState = true; pnlCtrl.Controls.Add(c);

Categories : Asp Net



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.