I have an ASP.NET Mvc application which will send a POST request to my Django website. Now I am getting CSRF verification failed. Request aborted.. How can I disable it.
1 Answer
Use @csrf_exempt decorator:
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def my_view(request):
...
7 Comments
Imran Qadir Baksh - Baloch
Thanks. But I am getting
MultiValueDictKeyError when I do request.POST['rml']Imran Qadir Baksh - Baloch
Thanks got it from stackoverflow.com/questions/5895588/…
catavaran
This error is thrown then there is no such parameter in
POST data. Use request.POST.get('rml') instead.Imran Qadir Baksh - Baloch
@warath-coder, its just a def and request.POST.get. Please try it
warath-coder
it works perfectly fine for me; why i ask to see your exact code; the form as well that is sending the POST data.
|