[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Client download .csv file from server using Response.TransmitFile

Posted on 2010-09-03
2
Medium Priority
?
417 Views
Last Modified: 2012-05-10
I am using the code below to enable clients to download a .csv file from my server.

The problem I am having is that when the file is saved to the client computer the file name is prefixed and suffixed with an underscore which leads to a file type of .csv_ which is obviously not a recognised file type.

How can I strip the underscores from the file name at the transmit stage?

        Dim FileName As String = LstBox1.SelectedItem.ToString
        Dim FilePath As String = "~/temp" & FileName
        Response.Clear()
        Response.ContentType = "text/csv"
        Response.AddHeader("Content-Disposition", "attachment; filename=\" & FileName & "\")
        Response.TransmitFile(FilePath)
        Response.End()
0
Comment
Question by:taylor99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 33596446
call replace inline on the filename.
Response.AddHeader("Content-Disposition", "attachment; filename=\" & FileName.Replace("_","") & "\")
0
 

Accepted Solution

by:
taylor99 earned 0 total points
ID: 33707245
see http://forums.asp.net/p/1598575/4065473.aspx#4065473 for resolution to this issue
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question