I , Me , Myself

My photo
Hi .. This is Sachin Uchil. I have been in the field of .NET development for about 2 years now. Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

Tuesday, April 24, 2007

System.Web.HttpException: 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.

In web.config write following...

"page enableviewstatemac="False"


The name 'Request' does not exist in the current context

This e
rror normally occurs when you are trying to access a property such as Request.Cookies and you're not doing that from a webform, usercontrol or a class that inherits from System.Web.UI.You can still access these properties, but using a different path.
For example to access a cookie with the name MyCookie you would normally use Request.Cookies["MyCookie"]; however, if the error The name 'Request' does not exist in the current context is returned, use the following path for retrieving the cookie:
System.Web.HttpContext.Current.Request.Cookies["MyCookie"];
This eror may also occour for "Server" etc..