You have an ASP.NET web application running on a web-farm that does not use sticky sessions - so the requests for a session are not guaranteed to be served the same machine. Occasionally, the users get error message Validation of viewstate MAC failed. What could be one reason that is causing this error?
The most common reason for this error is that the machinekey value in machine.config is different for each server. As a result, viewstate encoded by one machine cannot be decoded by another. To rectify this, edit the machine.config file on each server in the web-farm to have the same value for machinekey.
Get solution of all DOT NET,PHP,ASP,AJAX programming bugs or error like access is denied,unexpected error,fatal error,internal server error,run time error,compile time error.
Apr 1, 2008
What does the "Access is Denied" IE error mean?
The "Access Denied" error in any browser is due to the following reason.A javascript in one window or frame is tries to access another window or frame whose document's domain is different from the document containing the script.
Jan 22, 2008
Cannot use a leading .. to exit above the top directory
When I do a server.mappath on ../../private, I get this error:Cannot use a leading .. to exit above the top directory.
try to use Server.MapPath("~/private"). It is more reliable. What willhappen when u add another subdirectory... Server.MapPath("~/private") willstill works.
try to use Server.MapPath("~/private"). It is more reliable. What willhappen when u add another subdirectory... Server.MapPath("~/private") willstill works.
Jan 17, 2008
Is there any way to get detailed error information for Win32 errors when using Platform Invoke?
Yes, you can use the FormatMessage Win32 API. Sample projects for C# and VB.NET are enclosed. This is how the declaration looks like:
[DllImport("Kernel32.dll")]
public static extern int FormatMessage(int flags, IntPtr source, int messageId, int languageId, StringBuilder buffer, int size, IntPtr arguments );
Called like so:
// You can call FormatMessage to get a descriptive error message
StringBuilder sbFormatMessage = new StringBuilder(1024);
retVal = Interop.FormatMessage(Interop.FORMAT_MESSAGE_FROM_SYSTEM, IntPtr.Zero, Marshal.GetLastWin32Error(), 0, sbFormatMessage,
sbFormatMessage.Capacity, IntPtr.Zero);
[DllImport("Kernel32.dll")]
public static extern int FormatMessage(int flags, IntPtr source, int messageId, int languageId, StringBuilder buffer, int size, IntPtr arguments );
Called like so:
// You can call FormatMessage to get a descriptive error message
StringBuilder sbFormatMessage = new StringBuilder(1024);
retVal = Interop.FormatMessage(Interop.FORMAT_MESSAGE_FROM_SYSTEM, IntPtr.Zero, Marshal.GetLastWin32Error(), 0, sbFormatMessage,
sbFormatMessage.Capacity, IntPtr.Zero);
I get an error message "Property cannot be assigned to -- it is read only". How can I set this read only property?
When I try to set a particular font style, say italics, I get an error message "Property cannot be assigned to -- it is read only". How can I set this read only property?
Code such as
tabControl1.Font.Italic = true;
will not work. Instead, you have to create a new Font object, and set the property during its creation. This code will work.
tabControl1.Font = new Font(tabControl1.Font, FontStyle.Italic);
Code such as
tabControl1.Font.Italic = true;
will not work. Instead, you have to create a new Font object, and set the property during its creation. This code will work.
tabControl1.Font = new Font(tabControl1.Font, FontStyle.Italic);
Jan 16, 2008
I get a 'This would cause two bindings in the collection to bind to the same property' error message. What might cause this?
As the message suggests, the code is calling Control.DataBindings.Add twice with what amounts to the same parameters.One way this might happen is if you call the same code more than once in your program to reload your datasource for some reason, and in this code, you have lines such as:
Me.TextBox1.DataBindings.Add("Text", myDataTable, "Col1Name")
Me.TextBox2.DataBindings.Add("Text", myDataTable, "Col2Name")
Me.TextBox3.DataBindings.Add("Text", myDataTable, "Col3Name")
On the second call, this would attempt to add a duplicate binding to the DataBindings collection. One solution is to Clear the DataBindings collection before you add your new binding.
Me.TextBox1.DataBindings.Clear();
Me.TextBox1.DataBindings.Add("Text", myDataTable, "Col1Name")
Me.TextBox2.DataBindings.Clear();
Me.TextBox2.DataBindings.Add("Text", myDataTable, "Col2Name")
Me.TextBox3.DataBindings.Clear();
Me.TextBox3.DataBindings.Add("Text", myDataTable, "Col
Me.TextBox1.DataBindings.Add("Text", myDataTable, "Col1Name")
Me.TextBox2.DataBindings.Add("Text", myDataTable, "Col2Name")
Me.TextBox3.DataBindings.Add("Text", myDataTable, "Col3Name")
On the second call, this would attempt to add a duplicate binding to the DataBindings collection. One solution is to Clear the DataBindings collection before you add your new binding.
Me.TextBox1.DataBindings.Clear();
Me.TextBox1.DataBindings.Add("Text", myDataTable, "Col1Name")
Me.TextBox2.DataBindings.Clear();
Me.TextBox2.DataBindings.Add("Text", myDataTable, "Col2Name")
Me.TextBox3.DataBindings.Clear();
Me.TextBox3.DataBindings.Add("Text", myDataTable, "Col
Subscribe to:
Posts (Atom)