Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Excel Import #8899


User avatar
0
mahendra created

Hi there,

I am trying to import users from excel, but I am getting the below error: I am using ASPNetZero Version 8.0 with Angular.

POST http://localhost:22742/Users/ImportFromExcel 401 (Unauthorized)

Please assist...

Regards, Mahendra


7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Maybe related this issue: https://github.com/aspnetzero/aspnet-zero-core/pull/2799

    Can you check it?

  • User Avatar
    0
    mahendra created

    I always gets the 404 on the above URL. I am already signed with cxs-mahendra

  • User Avatar
    0
    maliming created
    Support Team

    You can invite anyone to become a member of the ASP.NET Zero organization using their GitHub username.

    https://aspnetzero.com/LicenseManagement

  • User Avatar
    0
    mahendra created

    Hi,

    I am using ASPNetZero 8.0 with angular. I created a duplicate of

    Web.Host\Controllers\UsersController.cs and Web.Core\Controllers\UsersControllerBase.cs

    and created the following

    Web.Host\Controllers\ImportExportController.cs and Web.Core\Controllers\ImportExportControllerBase.cs

    The issue, I am facing is: If I have following attribute on an action in the Web.Host\Controllers\ImportExportController.cs [AbpMvcAuthorize(AppPermissions.Pages_Administration_Users_Create)]

    My action never gets called and get the following error in Chrome developer console. GET http://localhost:22742/Account/Login?ReturnUrl=%2FImportExport%2FImportFromExcel 404 (Not Found) ERROR HttpErrorResponse {headers: HttpHeaders, status: 404, statusText: "Not Found", url: "http://localhost:22742/Account/Login?ReturnUrl=%2FImportExport%2FImportFromExcel", ok: false, …}

    But if I don't have the above attribute then the action gets called. But in this case I always get AbpSession.UserId as null.

    Please help

    Regards, Mahendra

  • User Avatar
    0
    mahendra created

    I had changed the startup as you suggested in your last email...

            ...............
            ...............
            app.UseAuthentication();
            //app.UseAuthorization();
            app.UseJwtTokenMiddleware();
    
            if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"]))
            {
                //app.UseJwtTokenMiddleware("IdentityBearer");
                app.UseIdentityServer();
            }
    
            app.UseAuthorization();
            ...............
            ...............
    
  • User Avatar
    0
    maliming created
    Support Team

    hi

    Can you check the application logs?

  • User Avatar
    0
    mahendra created

    Hi,

    This has been fixed... I saw one of your support ticket having same problem (the bearer token was not getting passed in the request) So I added the HttpInterceptor in our module and it started getting called.

    Regards, Mahendra