We have utilized the following ASP.NET code to facilitate the downloading of a CSV file through Response.Output.Write.
However, upon trying to download the file using the iOS PWA (web app), users found themselves unable to navigate back to the PWA app interface.
Is there a way to prevent this 'no way back' scenario?
https://i.sstatic.net/mPX3V.png
The code snippet used for CSV file download is presented below:
Private Function fCSVOutputCreateFile() As Boolean
'Code implementation here...
End Function
Your input and suggestions on addressing this issue would be highly appreciated.
UPDATE 1:
Despite attempting the solution proposed by Andrew Morton in the comments, the problem persisted on iOS PWAs, resulting in no option to return to the app interface. On desktops, however, the behavior remained unaffected.
~\pages\test\download\hdl1.ashx:
<%@ WebHandler Language="VB" Class="hdl1" %>
Imports System
Imports System.Web
Public Class hdl1 : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=1234.csv")
HttpContext.Current.Response.ContentType = "application/text"
HttpContext.Current.Response.Write("1a,2,3,4")
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
~\pages\test\download\default.aspx:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="pages_test_ashx_default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="LinkButton1" runat="server">Download</asp:LinkButton>
</div>
</form>
</body>
</html>
~\pages\test\download\default.aspx.vb
Partial Class pages_test_ashx_default
Inherits System.Web.UI.Page
Private Sub LinkButton1_Click(sender As Object, e As EventArgs) Handles LinkButton1.Click
Response.Redirect("~/pages/test/download/hdl1.ashx")
End Sub
End Class