.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Download a file with datagrid

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :ASP.Net


I know this is a newbie question...

I have this code:

                <asp:HyperLinkField HeaderText="Detalhes" Text="mais..."
                    DataNavigateUrlFields="C_FicheiroConsulta" DataNavigateUrlFormatString="{0}" />

But it's not doing what I want :(((

C_FicheiroConsulta is a field of a Table where it has the Full Path to a PDF file.

I want to click on the HyperlinkField and this action will save the file in User PC. Anu help is welcome

Thank you,


View Complete Post

More Related Resource Links

how to know when a user finish his file download successfully ?


hi all

i am doing a page to sell files online

 the paying method is by a card or bank account and the customer is not registered to the site so i want to make sure that the customer has downloaded the file successfully after that the system completes the payment operation

so if there is any way to know do that tell me please

i use c# thanx all



File Download Problem


Hi everyone,

I am using a download handler to handle the downloading of files from my website.  I am using a slightly modified code from the Microsoft article http://support.microsoft.com/kb/812406

Everything is working fine and downloading, even with large files, but it does not show the file size for any of the files to download. Even if theyre really small.

Here is my code for the handler

public class DownloadHandler : IHttpHandler

        public void ProcessRequest(HttpContext context)
            string path = "";
                path = context.Server.UrlDecode(context.Request.QueryString["src"]).DecryptString();
            catch(Exception ex)
            System.IO.Stream iStream = null;

            byte[] buffer = new Byte[10000];

            int length;

            long dataToRead;

            string filename = System.IO.Path.GetFileName(path);

                iStream = new System.IO.FileStream(context.Server.MapPath("~/" + path), System.IO.FileMode.Open,
                            System.IO.FileAccess.Read, System.IO.FileShare.Read);


Problem download file from SQL Server


Hello everyone. I am having an issue downloading files that I have store in SQL Server. I have no problem in a WinForm. What am I doing wrong in my code?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim sch As New clsReport
        Dim fileData As New clsReport.Letter
        fileData = sch.DownloadLetter(Session("LetterID"))
        Dim ms As System.IO.MemoryStream = fileData.fil

        Dim fil As Byte() = ms.ToArray
        Dim nam As String = fileData.name
        Dim ext As String = fileData.ext
        If Not fil Is Nothing Then
                ' Response.Clear()
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + nam & "." & ext)
                ' Response.AddHeader("Content-Disposition", nam & "." & ext)
                Response.AddHeader("Content-Length", fil.Length.ToString)
                Response.ContentType = "Application/octet-stream"
                Response.Buffer = True
            Catch ex As Exception
            End Try

        End If

    End Su

The file reached the maximum download limit. Check that the full text of the document can be meaning



I'm facing an issue with the indexing.

I have 1 WFE+Index server+DB server.

Index server is not installed with MS FIlter pack 1.0

When crawling, the there will be document with warning in crawl log:
The file reached the maximum download limit. Check that the full text of the document can be meaningfully crawled.

Documents that with warning are such as doc, ppt, xls, docs, ppts and many others.
However, I view into the successful crawled document, there are doucments with ext doc and ppt.

For large file index, there are MaxGrowthFactor + MaxDownLoadSize required to be added into the index server.

As my understanding is, MS Filter Pack should installed into index server(already did, correct me if i'm wrong).

I looked into the Office SharePoint Seach(CA>Services in farm), if the server is appointed to "Use this server as indexing server", then MS Filter Pack is suppose to be installed into that particular server as well.

At the bottom, there also has another option is "Use all web front end for crawling".

The question here is, IF the option "Use all web front end for crawling" is selected.
Does the WED FRONT END Server required to installed the Ms Filte

10 MB File Download In ASP.NET Socket Error

Hi,I received the following error message, when downloading file of 10 MB. Please let me know the solution. I already configured the httpRuntime value to <httpRuntime maxRequestLength="10250 " executionTimeout="1000". Still I am getting the error message.The description for Event ID ( 0 ) in Source (XXXXX) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Unable to read data from the transport connection: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full. Source: mscorlib TargetSite: Void HandleReturnMessage(System.Runtime.Remoting.FileUploading.IFileUpload, System.Runtime.Remoting.FileUploading.IFileUpload) StackTrace: Server stack trace:    at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size)   at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)   at System.IO.BinaryReader.ReadBytes(Int32 count)   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadArrayAsBytes(ParseRecord pr)   at System.Runtime.Seri

Download a file from web and save dialog box for path

Hi I need to download a exe file from a web site. I need to prompt a savedialog box for the user to select a path to save it. This the code i have. How can i show a save dialog box here?         Private Sub downloadfile()         Dim client As New Net.WebClient         client.DownloadFile("www.mysite.com/Information/Myexe.exe", "Sr.exe")     End Sub Thanks

How to initiate a file download from withing UpdatePanel?

Hi all, I'm building dynamically a series of ImageButton controls, and I want to assign them a hyperlink for downloading files. So say you got a dropdownlist of 3 items 1,2 and 3, if you select 1 it creates one imagebutton and pointrs to fileA, if you select 2 it creates two imagebuttons and the first one points to fileA and the second one to fileB and so on... Everything is wrapped in an UpdatePanel to avoid postbacks. I have a problem binding the download link in the ImageButton.navigateurl, and then downloading it. I don't know how to do it...   protected void Button1_Click(object sender, EventArgs e)    {        Panel myPanel = (Panel)UpdatePanel1.FindControl("Panel1");             string[] Uploaders = new string[CheckBoxList1.Items.Count -1];        for(int i = 0; i < CheckBoxList1.Items.Count; i++)        {            if(CheckBoxList1.Items[i].Selected)                  Uploaders[i] = CheckBoxList1.Items[i].Text;         }              my

Client download .csv file from server using Response.TransmitFile

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() 

how to check one time java script file download not every session

how to check one time java script file download not every session

Prompt for "File Download" on Page Viewer Web part pointing to .htm file

I am in the process of moving my 2007 site over to 2010. On some of my sites I have a page viewer web part that points to a .htm file. It works great in 2007, but in 2010 I get a "File Download" prompt. Any ideas? Thanks --tolga

code of file download

Dear friends,       Please send me a code of file downloading in ASP.NET with VB       Thanks, PIYUSH              

Force File Download on a Remote File Server

Hi!I'm trying to force a large (200+ MB) file to download that's on a remote server. The problem is that I can't use the "WriteFile()" function, since I'm not using a virtual path.Then, when I try:Response.AppendHeader("content-disposition",                 "attachment; filename=" + name);Response.AppendHeader("content-disposition", "attachment; filename=" + name);I get a file that has the correct name and extension, but is 0KB. Can someone please help me?!Thanks!-Eric

download the pdf file from asp.net page

am very new to asp.net . how to download the .pdf file from the .aspx page

How to Download a file with a hyperlink

I have been all over the net reading samples to this, they are not for ASP 2.0 or the example code given does not work. So could someone PLEASE put this simple thing in black and white?  Assuming you have created a blank aspx lets say Downloading.aspx and are going to hyperlink from links.aspx... and all your files that you want available for the client to download are stored in a public folder on your domain lets say mydomain/downloadstuff. 1. Example of hyperlink to use on links.aspx   2. Code to use on downloading.aspx (assume to use the octet thing that supports all types of files) and does the code go in downloading.aspx or downloading.aspx.vb   thanks, Brad Zynda

Download .xlsx file from server

Hi, Iv created a web application using vb.net 2005. Its working fine and running fine on the server (Microsoft Server 2003). The problem i have is to dowload a file from the same server using vb.net. I tried using this code but it gives me a : "is not a virtual path" error. Response.ContentType = "file/xlsx" Response.AppendHeader( Response.TransmitFile( Response.End()"Content-Disposition", "attachment; filename=AllReports.xlsx")".xlsx") Please help, im way overdue with this. Thank.

Which download file - x86, or x64?

I need to download a security update for .NET framework 2.0, for offline installation, but I don't know which file version/architecture to use for my system - x86, or x64 ? It has an AMD64 processor, but the OS is Win XP Pro 32-bit, and I've installed AMD's 32-bit CPU driver.  

File Download does not continue after IE Security warning

Hello. First let me give a reference to my code which is in another post  http://forums.asp.net/t/1600899.aspx I'm running into an issue where in IE the security dialog is popping up and if I click download File the file is never downloaded..it just goes back to the main page. I'm using a web service to generate the file on disk and then setting the src of the iframe to the file..I also tried an alternate approach of setting the src of the frame to an aspx page that pretty much does the following:  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim file As String = Request.QueryString("file") Response.Clear() Response.ClearHeaders() Response.BufferOutput = False Response.ContentType = "application/zip" Response.AddHeader("content-disposition", "attachment; filename=" + file) Response.TransmitFile(file) Response.Close()     works fine in firefox but not IE...
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend