Problem downloading a file in ASP.NET

A

Andrix

HI,
I have this code to do an .xls from a data grid, and then download to
the client machine.
In my intranet works excelente. But in the internet, when i click in
the button "Export to Excel" open the download dialog, but ask me to
download the .aspx file (that contain the next code) ??

this app in asp.net is under a SSL connection.

what it could be????

Thanks

Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.xls"

Dim filename As String
filename = .....

Response.AddHeader("content-disposition",
"attachment;filename=" & filename)
Response.Charset = ""

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Me.EnableViewState = False

Dim stringWrite As System.IO.StringWriter = New
System.IO.StringWriter()
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New
HtmlTextWriter(stringWrite)

Me.DataGrid1.AllowPaging = False
Me.CargarDatos("")

Me.ClearControls(Me.DataGrid1)
Me.DataGrid1.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()

Me.DataGrid1.AllowPaging = True
Me.CargarDatos("")

Me.EnableViewState = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top