Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Creat a class and inherit form actionfilterattribute and override OnResultExecuted method</p> <pre><code>Public Class DeleteFileAttribute Inherits ActionFilterAttribute Public Overrides Sub OnResultExecuted(ByVal filterContext As ResultExecutedContext) Dim path As String = filterContext.HttpContext.Server.MapPath("~/LocalizeData") Dim filename As String = DirectCast(filterContext.Result, CSVResult).FileName 'filterContext.RouteData.Values("Path").ToString() If File.Exists(System.IO.Path.Combine(path, filename)) Then File.Delete(System.IO.Path.Combine(path, filename)) End If End Sub End Class </code></pre> <p>and apply delete attribute on function</p> <p>for example </p> <pre><code>&lt;DeleteFile()&gt; Public Function GetCSVFile(ByVal listSeperator As String) As CSVResult Dim result As Boolean Dim Service As New Service() Dim types As IList(Of ProductType) = Service.GetAllWithAllLocalizedNames(New ListOptions(Name", OrderByDirection.Ascending, 1, -1)) Dim path As String, colname As String colname = Settings.GetLanguage() path = Common.GetLocalizeDataPath() Dim seprator As String = Common.GetListSepratorForCSV(listSeperator) Dim cs As New CSVGenerator(path, colname, seprator) result = cs.CreateCSVFile(types) If result Then Return New CSVResult With {.FileName = "Sample.csv", .Path = "~/Mydir/Sample.csv"} Else Return New CSVResult With {.FileName = "Error.csv", .Path = "~/Mydir/Error.csv"} End If End Function </code></pre> <p>and one more issue on execute result please flush the reponse and close it</p> <pre><code>context.HttpContext.Response.Flush() context.HttpContext.Response.End() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload