Wednesday, September 1, 2010

How To Fix the: “Validation of viewstate MAC failed” Error (ASP.NET MVC)

Backup from


http://adam.kahtava.com/journal/2009/11/23/how-to-fix-the-validation-of-viewstate-mac-failed-error-aspnet-mvc/


The “Validation of viewstate MAC failed” error only occurred when a page contained an HTML form element that made use of MVC’s AntiForgeryToken. The quick fix was to delete my __RequestVerificationToken cookie, but the error would rear its ugly head the minute I touched my assemblies. The long term solution was to add a machineKey element to my Web.config file - asking visitors to delete a specific cookies when visiting my site was not a viable option.

How I fixed the “Validation of viewstate MAC failed” error on Shared Hosting:

  1. I used the Generator Tool to generate a machine key
  2. I added the machineKey element to my Web.config file

My Web.config now looks similar to this:




Anyhow, I hope this post helps anyone else that’s encountering this error.

Saturday, August 21, 2010

URL Rewriting with Session problem

URL Rewriting with Session problem

Using URL Rewriter with session

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration.




A solution that worked perfectly! Add the following to web.config:









Solution provided by Curt
http://forums.asp.net/t/1499512.aspx

Tuesday, July 13, 2010

simple detect iphone browser

script
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "/mobile/";
}
/script

Tuesday, June 8, 2010

Synology sometime does not recognize some NTFS External HDD

According to http://59.124.41.244/enu/viewtopic.php?f=12&p=78410&sid=e6ee050cf8f8c732278721360f16bfb5

It is because of the cluster size,

I finally used Acronis Disk Director Suite to format it,

then it WORKS!!!

Monday, April 19, 2010

black berry chinese

How do I upgrade the OS on my device? Follow these instructions:

1. Download and install to PC the latest version of Desktop Manager from here: ( BlackBerry Operating System Downloads )

2. Download the new OS you want and install it to the PC

3. Open Desktop Manager and do a complete backup of your current device.

4. Delete the vendor.xml file located in c:\program files\common files\research in motion\apploader

5. Plug in BB and open Desktop Manager

6. Select Application Loader

7. You will be prompted to upgrade




http://www.blackberrycool.com/2010/01/12/how-to-upgrade-your-blackberry-os-software-2010-version/

http://www.blackberryfaq.com/index.php/How_do_I_upgrade_the_OS_on_my_BlackBerry%3F

***** Remember to turn pc internet off and delete vendor.xml

Sunday, April 11, 2010

traditional chinese problem with extplorer

http://chs-yoga.com/fenix/component/content/article/7-extensions/41-extplorer-cht

apply to 2.01

extplorer is file manager written by php

SQL Server remote connecting problem

Issue: can't connect to sql server,

fix:
open the port http://support.microsoft.com/kb/968872
or http://support.microsoft.com/kb/914277
enable the remote connection in the properties using management studio
enable tcp/ip in configure manager

to add user
use management studio -> security