Open Closed

Status Code: 400 using dropzone library #2339


User avatar
0
yasin.hallak.89@gmail.com created
  • ABP Framework version: v5.0.0

  • UI type: MVC

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): no

  • Status Code: 400 .

hello bro ...
I have stopped ConfigureAutoApiControllers in my proj as shown in the following figure :

image.png

and I have creaded new FileController as shown in the following figure :

image.png

when I send request from swagger it work done and Status Code :200 as shown in the following figure :

image.png

but by using dropzone libraray as shown in the following figure :

image.png

and send request from UI MVC it doesn't work and give me Status Code :400 as shown in the following figure :

image.png

the question

why give me status code 400 . Although I have used same url in swagger ?

thank u ...


12 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I guess you need to add antiForgeryToken to the request header.

    Try:

    new Dropzone('....',{ 
        ..........
        headers: { 
            abp.security.antiForgery.tokenHeaderName: abp.security.antiForgery.getToken()
        }
        ....
    });
    
  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Hi,

    I guess you need to add antiForgeryToken to the request header.

    Try:

    new Dropzone('....',{  
        .......... 
        headers: {  
            abp.security.antiForgery.tokenHeaderName: abp.security.antiForgery.getToken() 
        } 
        .... 
    }); 
    

    hi
    give me this error Uncaught SyntaxError: Unexpected token '.' as shown in the following figure :

    image.png

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    What happens when you use abp.security.antiForgery.tokenHeaderName and abp.security.antiForgery.getToken() in the browser's console tab?

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Hi,

    What happens when you use abp.security.antiForgery.tokenHeaderName and abp.security.antiForgery.getToken() in the browser's console tab?

    image.png

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    HI,

    Sorry my bad, please try:

    var tokenHeaderName = abp.security.antiForgery.tokenHeaderName;
    var token = abp.security.antiForgery.getToken();
    
    new Dropzone('....',{  
        .......... 
        headers: {  
            tokenHeaderName : token
        } 
        .... 
    }); 
    
  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    var tokenHeaderName = abp.security.antiForgery.tokenHeaderName;
    var token = abp.security.antiForgery.getToken();

    hi
    give me Status code :400 as shown in the following figure :

    image.png

    but when rename tokenHeaderName to requestverificationtoken it work very well

    image.png

    thank u

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you share the full HTTP request and response?

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Hi,

    Can you share the full HTTP request and response?

    hi sorry for lating

    1. this is when I use tokenHeaderName and give me Status code :400 as shown in the following figure :

    image.png

    image.png

    1. this is when i use requestverificationtoken and give me status code :200 as shown in the following figure :

    image.png

    image.png

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Please consultation

    I have two module one Recruitment and another HR ..

    I have special settings for each of them and some common settings for them ..

    Do you prefer to create a module for the settings and put all the settings in it , Or put the settings for each module in the same model

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can create a shared project, like xx.Domain.Shared for common settings.

  • User Avatar
    0
    yasin.hallak.89@gmail.com created

    Hi,

    You can create a shared project, like xx.Domain.Shared for common settings.

    Hi
    I mean I have some common entities between tow module like country entity

    Do you prefer to create a new module for common entities?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Do you prefer to create a new module for common entities?

    This is ok if they are common.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 11, 2025, 10:10