Starts in:
1 DAY
20 HRS
27 MIN
22 SEC
Starts in:
1 D
20 H
27 M
22 S

Activities of "Sturla"

Finally found this out... you need to add WithExposedHeaders("customheader")for all the headers you want to include. Now this is being returned!

Closing this

OK I found out what is stripping the headers away

WithAbpExposedHeaders()

if I swap that out with

WithExposedHeaders("*")

I get all the headers.

But what does that mean and is that a viable sultion?

Ok I found an issue talking about this here

.. in the Blazor WASM application, there is no need to use cookies for authentication. So browser cross origins, headers are removed, and the response headers are not returned in the success event.

and then says

As a result, we recommend calling the AllowCredentials() method, as shown in the code snippet below, to allow header configuration in the startup page.

But my ConfigureCors() is just the same (similar)

But something must be stripping out the headers so any idea?

Yes I can't see that its returned in their SuccessEventArgs. Any idea?

Ok didn’t see it because I was just looking at the response in code. Then the method Im using there to get the headers is not a good one (just using Syncfusion code example)

Here it is but you can also try it out your self with the demo just as before (I had updated it to try to return the headers)

One more related question, how can I add custom header to the response?

This doesn't work in the controller Response.Headers.Add("BlobName", "content"); but I can still manipulate the response like with Response.ContentType = "THIS IS RETURNED!!"

public virtual async Task Save(IList<IRemoteStreamContent> UploadRecording) 
{
    try
    {
        Response.Headers.Add("CustomHeader", "someContent"); //<-- Isn´t returned!
        Response.ContentType = "THIS IS RETURNED!!"; //<-- BUT this is!
    }
    catch (Exception e)
    {
        Response.Clear();
        Response.StatusCode = 204;
        
        Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "File failed to upload";
        Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = e.Message;
    }
}

Here in Blazor I'm trying to get the response back when successfully uploaded a file to the controller.

I'm just going after the Syncfusion example so there must be something else I need to do ?

Answer

I needed (I think) to add the following web.config to the HttpApi.Host project to increase upload size with the following config

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <!-- To customize the asp.net core module uncomment and edit the following section. 
  For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
  <!--
  <system.webServer>
    <handlers>
      <remove name="aspNetCore"/>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
  -->
  <location path="Recording/recording-upload">
    <system.webServer>
      <security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="4096000" />
        </requestFiltering>
      </security>
    </system.webServer>
  </location>
</configuration>

And then I get this error when running the app with Azure Appservice

2021-12-21 13:54:57.472 +00:00 [ERR] Connection ID "17509995361417066312", Request ID "80007749-0002-f300-b63f-84710c7967bb": An unhandled exception was thrown by the application.
Volo.Abp.Http.Client.AbpRemoteCallException: Not Found
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.ThrowExceptionForResponseAsync(HttpResponseMessage response)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](ClientProxyRequestContext requestContext)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies.AbpApplicationConfigurationClientProxy.GetAsync()
   at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.<GetAsync>b__14_0()
   at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
   at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.GetAsync()
   at Volo.Abp.AspNetCore.Mvc.Client.RemoteLanguageProvider.GetLanguagesAsync()
   at Microsoft.AspNetCore.RequestLocalization.DefaultAbpRequestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
   at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

I haven't tried to upload a bigger file than 30 MB but if that doesn´t work without the web.config file I´ll need some way to add it. But I´ll try that tomorrow.

Thank you! I'll then use IRemoteStreamContent Now closing this

Ok ok that was not obvious so thank you so much!

But should I use IList<IFormFile> or IList<IRemoteStreamContent> because both work?

Is there any benefit for me using IList<IRemoteStreamContent> here?

Showing 131 to 140 of 174 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06