Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
Hi..

I want to Export from HTMLTable to excel, actualy my export is work fine and export files are automatically created in the download folder, and my problem how to set destination the export files in "C:\"
this my file.aspx
ASP.NET
<asp:Literal ID="litTable" runat="server" />

and my file.aspx.vb
VB
Protected Sub btnPdfExport_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnPdfExport.Click
        Dim StrHtmlGenerate As New StringBuilder()
        Dim StrExport As New StringBuilder()
        Response.ContentType = "application/x-msexcel"
        Response.AddHeader("Content-Disposition", "attachment;filename=ExcelFile.xls")
        Response.ContentEncoding = Encoding.UTF8
        Dim tw As New StringWriter()
        Dim hw As New HtmlTextWriter(tw)
        litTable.RenderControl(hw)
        Response.Write(tw.ToString())
        Response.End()
    End Sub


please help my how to set destination the export files in "C:\"

Thanksyou
Posted
Comments
Sergey Alexandrovich Kryukov 21-Jan-16 1:14am    
How "export files in "C:\" can possibly be related to ASP.NET? What do you mean by that?
With ASP.NET, you simply write output into the response stream of HTTP response, with corresponding content-type...
—SA
IshaqSalam 21-Jan-16 1:32am    
The point is i want to change default destination downloaded file from "download" folder to the "C:\", and i want to set this by source code.

Sergey Alexandrovich Kryukov 21-Jan-16 1:40am    
In ASP.NET? Are you serious?
Do you mean downloading to the client side? Or "downloading", in contrast to downloading, is something else?
—SA
IshaqSalam 21-Jan-16 2:05am    
yes, downloading to the client side.
do you think if it could?
if it can't how about downloading to server side with set destination in application folder?

My goal is i want to send an email by attaching an excel file from html table.

1 solution

IshaqSalam clarified:
yes, downloading to the client side.
do you think if it could?
if it can't how about downloading to server side with set destination in application folder?

My goal is i want to send an email by attaching an excel file from html table.
Thank you for the clarification. Is I was afraid of, the question makes no sense. ASP.NET application, as any other Web application, has not control over the client side, and the client-side script has no control over the location of the downloaded file. This is designed this way for safety reasons. Only the browse user defines where to save all files or any particular file.

Just think about it: on many platforms, such thing as disk "C:" does not exist, even as a concept. And on Microsoft platforms which has this concept, the disk "C:" may be missing, even on Windows system with one or more hard drives. Moreover, "C:\*" (more exactly and generally, the volume the OS is located) is not a legitimate location for downloaded files.

—SA
 
Share this answer
 
Comments
IshaqSalam 21-Jan-16 2:47am    
thanks for your quick respons.
so, do you have suggestion, solution, clue or excample for my case
" i want to send an email by attaching an excel file from html table"

thanks SA :)
Sergey Alexandrovich Kryukov 21-Jan-16 3:05am    
Oh... How is it related to you original question.
I answered on sending a e-mail with HTML several times. This is a pretty easy thing. You can easily find a solution if you search CodeProject...

First of all, will you accept my present answer formally? I answered on the question you asked, you never mentioned e-mail, which is completely different story.

—SA
IshaqSalam 21-Jan-16 3:34am    
Oke.

Thanks SA :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900