# Request interrupted for ReturnFileAsync

**URL:** <https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323>\
**Category:** Discussion in English\
**Created:** [June 10, 2025, 2:27pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323 "2025-06-10T14:27:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MZabel67](https://forum.dotvvm.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@MZabel67](https://forum.dotvvm.com/u/MZabel67)\
**Post date:** [June 10, 2025, 2:27pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/1 "2025-06-10T14:27:33Z")

</div>

Trying to use the Return File Async  
MemoryStream ms = new MemoryStream(ExportDataBytes)  
{  
Position = 0  
};  
await Context.ReturnFileAsync(ms, “ConfirmationTracking.csv”, “text/csv”).ConfigureAwait(false);  
from  
\<dot:Button Click=“{command: ExportGridData(exportData)}” Text=“Export” ButtonTagName=“input”/\>  
Dotvvm version  
Keep getting this error on the await line in C#:  
DotVVM.Framework.Hosting.DotvvmInterruptRequestExecutionException: ‘Request interrupted: ReturnFile (ConfirmationTracking.csv)’

The file is getting created in the temp directory as per  
options.AddDefaultTempStorages(“temp”);

What Am I missing?

---

<div class="post-metadata">

**Author:** ![exyi](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/exyi/32/9_2.png) [@exyi](https://forum.dotvvm.com/u/exyi)\
**Post date:** [June 10, 2025, 4:20pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/2 "2025-06-10T16:20:12Z")

</div>

That means your the file should be successfully returned (instead of the standard HTTP response). The exception is just a way to terminate the request processing; it’s a common pitfall, but we don’t really have another way of doing that.

> **[DotVVM Blog: Why I am getting the DotvvmInterruptRequestExecutionException?](https://www.dotvvm.com/blog/1/Why-I-am-getting-the-DotvvmInterruptRequestExecutionException-)**
>
> When you call the Context.Redirect method in the viewmodel, DotVVM needs to interrupt processing of the current request. This is done by throwing the DotvvmInterruptRequestExecutionException exception.

---

<div class="post-metadata">

**Author:** ![MZabel67](https://forum.dotvvm.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@MZabel67](https://forum.dotvvm.com/u/MZabel67)\
**Post date:** [June 10, 2025, 8:19pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/3 "2025-06-10T20:19:47Z")

</div>

No file downloads. Thoughts?

---

<div class="post-metadata">

**Author:** ![exyi](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/exyi/32/9_2.png) [@exyi](https://forum.dotvvm.com/u/exyi)\
**Post date:** [June 11, 2025, 7:12am UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/4 "2025-06-11T07:12:48Z")

</div>

You should avoid handling this exception, it should be left to propagate back to DotVVM.

Can you please inspect the network communication, what response is returned from the postback? (just see devtools Network tab). Are there any messages in client-side log or the server-side log?

---

<div class="post-metadata">

**Author:** ![MZabel67](https://forum.dotvvm.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@MZabel67](https://forum.dotvvm.com/u/MZabel67)\
**Post date:** [June 11, 2025, 12:50pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/5 "2025-06-11T12:50:47Z")

</div>

[NullReferenceException: Object reference not set to an instance of an object.]  
DotVVM.Framework.Storage.d\_\_12.MoveNext() in /_/src/Framework/Framework/Storage/FileSystemReturnedFileStorage.cs:80  
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32  
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62  
System.Runtime.CompilerServices.ConfiguredTaskAwaiter.GetResult() +38  
d\_\_22.MoveNext() in /_/src/Framework/Framework/Hosting/DotvvmRequestContextExtensions.cs:268  
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32  
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62  
System.Runtime.CompilerServices.ConfiguredTaskAwaiter.GetResult() +29  
VeritasMVC.ViewModels.AllFiles.BankruptcyReports.d\_\_7.MoveNext() +3528  
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32  
System.Web.Util.SynchronizationHelper.SafeWrapCallback(Action action) +114

---

<div class="post-metadata">

**Author:** ![MZabel67](https://forum.dotvvm.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@MZabel67](https://forum.dotvvm.com/u/MZabel67)\
**Post date:** [June 11, 2025, 3:21pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/6 "2025-06-11T15:21:36Z")

</div>

Just got it working, thanks for your help!

---

<div class="post-metadata">

**Author:** ![exyi](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/exyi/32/9_2.png) [@exyi](https://forum.dotvvm.com/u/exyi)\
**Post date:** [June 11, 2025, 8:03pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/7 "2025-06-11T20:03:31Z")

</div>

Great! What helped in the end?

---

<div class="post-metadata">

**Author:** ![MZabel67](https://forum.dotvvm.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@MZabel67](https://forum.dotvvm.com/u/MZabel67)\
**Post date:** [June 13, 2025, 5:32pm UTC](https://forum.dotvvm.com/t/request-interrupted-for-returnfileasync/323/8 "2025-06-13T17:32:59Z")

</div>

I added too much code that interferred, so i simplified it. Also my VS is set to break on all faults. Never saw where i could continue and then it worked. Do you have any examples of custom form editor? thanks.
