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 :

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

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

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

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

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 :

  • 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?

  • 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 :

    but when rename tokenHeaderName to requestverificationtoken it work very well

    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 :

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

  • 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.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06