Activities of "EngincanV"

Hi @ldacnfinit, can you try to create a UOW in your ImportByExcelFile method manually, like below:


private readonly IUnitOfWorkManager _unitOfWorkManager;

public virtual async Task> ImportByExcelFile(IFormFile file) 
{
     using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
     {
      //...
      
      await _identityUserManager.CreateAsync(ObjectMapper.Map(s), userPwd, false);
      
      await uow.CompleteAsync();
     }
}

https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work

Hi @shobhit, I suggest you to controlled upgrade your application to v5.1, which means first upgrade to v4.3 and then v4.4 and then so on.

You can follow the following migration guides to see the breaking changes and additional notes:

Also, you can read the blog posts to see the new features by version, from our blog website.

What are the latest features in 5.1

You can read the new features that come with v5.1 from here.

Hi, with v5.1 Angular 13 is supported and v5.1 ABP Startup Templates use Angular 13.

https://blog.abp.io/abp/ABP.IO-Platform-v5-1-Has-Been-Released

Hi @selinkoykiran, your problem will be resolved with this PR.

Hi @SouravParia, we have a sample project named StoredProcedureDemo, maybe you can check AppUserRepository.cs in this sample project.

using (var command = CreateCommand("<your_stored_procedure_name>", CommandType.StoredProcedure, new SqlParameter[] { /* your parameters: E.g. new SqlParameter("id", id) */ }))
{
    //your logic...
}
Configure<AbpAntiForgeryOptions>(options =>
{
    options.AutoValidateIgnoredHttpMethods.Remove("GET"); //auto validate for GET requests
});

After I've configured the AbpAntiForgeryOptions as above, I could not send a successful GET request to my endpoints unless I provide a RequestVerificationToken header.

But if there is an interceptor and passes a RequestVerificationToken on behalf of me, I can successfully make a GET request as follow. (And we do it on Swagger UI)


So can you try to navigate the URL of one of your GET requests on the browser? I am not sure but "burpsuite" might be intercepting the request and passing the RequestVerificationToken automatically (maybe you can check the header that it passed).

Hi @Anjaneyulu, you're not sending requests via Swagger right?

Then you can create a middleware as below and get the generated cookie and pass it to the RequestVerificationToken header.

P.S. If your GET requests don't change the state (and it shouldn't in most cases), you don't need to add anti-forgery token validation, in my opinion.

public class SetRequestVerificationHeaderMiddleware
{
    private readonly RequestDelegate _next;
    private readonly IAbpAntiForgeryManager _abpAntiForgeryManager;

    public ValidateAntiForgeryTokenMiddleware(RequestDelegate next, IAbpAntiForgeryManager abpAntiForgeryManager)
    {
        _next = next;
        _abpAntiForgeryManager = abpAntiForgeryManager;
    }

    public async Task Invoke(HttpContext context)
    {
        if (HttpMethods.IsGet(context.Request.Method))
        {
           var antiForgeryToken = await _abpAntiForgeryManager.GenerateToken();
           context.Request.Headers["RequestVerificationToken"] = antiForgeryToken;
        }
        
        await _next(context);
    }
}

//use middleware
app.UseMiddleware<SetRequestVerificationHeaderMiddleware>();

When you enabled auto validation for GET requests, you need to pass the RequestVerificationToken header with your requests. Unless you'll get an HTTP 400 error. But if you're making your requests via Swagger you won't get that error because a request verification token is set on behalf of you in every request. (https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Swashbuckle/wwwroot/swagger/ui/abp.swagger.js#L25-L29)

So try to send a request to one of your services via Postman or simply using a browser, you'll get the following error.

You can generate and set the cookie for your requests, useIAbpAntiForgeryManager.SetCookie() method.

I am closing the question since your problem seems resolved with this issue. Thanks @jhsanc

Showing 561 to 570 of 730 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11