The anti-forgery cookie token and form field token do not match

0

Asp.Net MVC 4 uygulamasında Login işleminde aşağıdaki gibi bir hata ile karşılaşıyorum.

The anti-forgery cookie token and form field token do not match hatasının çözümü nedir?

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.Mvc.HttpAntiForgeryException: The anti-forgery cookie token and form field token do not match.

Source Error: 


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 


[HttpAntiForgeryException (0x80004005): The anti-forgery cookie token and form field token do not match.]
alattin alattin (16984)
7 yıl önce sordu

    Toplam 1 Cevap


    0

    The anti-forgery cookie token and form field token do not match hatasının çözümü nedir?

    The anti-forgery cookie token and form field token do not match hatasının çözümü için web.config dosyasında bazı değişklikler yapmanız gerekebilir.

    Bu durum özellikle paylaşımlı hosting ve sunucu değiştirme işlemlerinizde karşınıza gelecektir.

    Güvenlik için kullanılan Cookie'de bir karışıklık olduğunda bu hata karşınıza çıkabilir. Normal de Cookie temizlediğinizde sorun düzelecektir.

    Diğer bir durumda ise web.config dosyanıza MachineKey ekleneniz gerekebilir.

    Bunun için web.config dosyanızda 

    <system.web>
    
    </system.web

    arasına MachineKey kodu eklemelisiniz. Öncelikle http://www.developerfusion.com/tools/generatemachinekey/ adresinden sunucunuza bir MachineKey üretin.

    Ürettiğiniz Machine Key kodu şuna benzeyecektir:

    <machineKey 
      validationKey="D3BF294884FC71302A285E4317DE4AAAEE4A39EC1F821795145B2DC5C6FFB5600A410F4DAE8A69E54D78C27068B43692182BEDF2807EE137AE4A7309B490938C"
      decryptionKey="2396146BD590146B84DA86E673DBBFA44A297BF2B5938DA9389CED93B546DF91"
      validation="SHA1" decryption="AES"
    
    />
    

    Güvenlik için bu kodun aynısını kullanmayın yukarıdaki linkten kendinize özel bir kod üretin.

     

    alattin alattin (16984)
    7 yıl önce cevaplandı

      üyelik gerektirir

      Cevap yazabilmek için üye girişi yapmalısınız.

      Eğer uzmanim.net üyesiyseniz giriş yapabilirsiniz: üye girişi yap
      uzmanim.net'e üye olmak çok kolaydır: hemen kayıt ol