C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Errors and Solutions » General »

How to fix Validation of Validation of viewstate MAC failed error


Posted Date: 06 Nov 2009    Resource Type: Errors and Solutions    Category: General
Author: PrajeeshMember Level: Gold    
Rating: 1 out of 5Points: 2



One possible solution is to add following code snippet to your web.config file.


<pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" />


For more details, visit http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx



Responses

Author: venkatesan    12 Nov 2009Member Level: Diamond   Points : 2
I accept your solution -> ValidateRequest="False" to make the site has a chance of Security breach , so you can use this on Page where its need ,No Need to use overall the application and for the remaining field use Server.HTMLEncode().

And Could you explain about the enableEventValidation and ViewStateEncryptionMode

Explaing clearly on which situation it will use, if not using this what happen ? what type of Error it shows.




Author: Prajeesh    12 Nov 2009Member Level: Gold   Points : 2
Hi venkatesan,
You are right it causes a security breach, but in some situation this error may come in any of the pages so we have to use in web.config file.

see below links see answers to your questions:

http://msdn.microsoft.com/en-us/library/system.web.ui.page.enableeventvalidation.aspx

http://msdn.microsoft.com/en-us/library/system.web.ui.page.viewstateencryptionmode.aspx






Author: venkatesan    12 Nov 2009Member Level: Diamond   Points : 2
We know where we store the Html tags so if its a CMS Project , definitely we need editor control to format the text etc.. so here , the page where we using there you should use ValidateRequest=False on the pageDirective

so there may be cause it throws error when this will not used in other pages. because we have not validate the user input so if the user type any html tags it will store the as its in database.

Why can't we use Html.Econde(TextBox1.Text) for the other pages.

then you gave a link for the others , Better give solution on your own words.

If you given as a link , I can google it to show the no.of links as like u.

Thanks


Author: Prajeesh    12 Nov 2009Member Level: Gold   Points : 2
Hi venkatesan,
I am not a .net expert like you, i am beginner here, but i am trying to share experience in my projects within my little knowledge and i may not get enough time to post descriptive answers always that's why i am giving link to other sites that provides more details about the problem.




Author: venkatesan    12 Nov 2009Member Level: Diamond   Points : 0
Its ok...I am not an expert.


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Viewstate  .  Validation  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: What are .SQM files? How to remove them from C:\ drive?
Previous Resource: How to Create Virtual Machine for Windows 2003 Server?
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use