Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Using response.writefile opens PDF with unexpected name

$
0
0

I'm using Visual Web Developer 2010 Express with SQL Server 2008 Express, VB.

I'm using the code below to open a PDF.  For example in this case let's say PCB (PDF file) is C0603.pdf.  The sub opens the correct PDF but the PDF viewer calls it Capacitors.aspx.pdf.  The sub is part of Capacitors.aspx so that is where the name is coming from but how can I get it to display the correct name when it opens the file?  Is there something I've overlooked?

    Protected Sub Button13_Click(sender As Object, e As System.EventArgs)   'View footprint PDF
         Response.Clear()
         Response.ContentType = "application/pdf"
         Context.Response.AddHeader("Content-Disposition", "attachment=" + PCB)
         Response.WriteFile(PCB)
         Response.End()
    End Sub

Thanks!


Viewing all articles
Browse latest Browse all 3509

Trending Articles