filedownloading [modified]
-
hi frns i have developed one application in that i have one gridview in that i have one column (filename)with hyperlink when i click on that link i am getting the filedownload window asking to save or open but i want the file to be displayed directly instead of asking in the browser. any suggestions grately appreciated regards :)sunilwise -- modified at 4:35 Thursday 15th November, 2007
-
hi frns i have developed one application in that i have one gridview in that i have one column (filename)with hyperlink when i click on that link i am getting the filedownload window asking to save or open but i want the file to be displayed directly instead of asking in the browser. any suggestions grately appreciated regards :)sunilwise -- modified at 4:35 Thursday 15th November, 2007
Link to a page which takes the filename off the URL and does a Response.BinaryWrite to send the file into the browser to be displayed.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Link to a page which takes the filename off the URL and does a Response.BinaryWrite to send the file into the browser to be displayed.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
its working in local system but if i try to open it in another system which is connected through lan again that filedownload window is opening sir
-
hi frns i have developed one application in that i have one gridview in that i have one column (filename)with hyperlink when i click on that link i am getting the filedownload window asking to save or open but i want the file to be displayed directly instead of asking in the browser. any suggestions grately appreciated regards :)sunilwise -- modified at 4:35 Thursday 15th November, 2007
-
If you are using Response.AppendHearder("Content-Disposition"........) remove it, it will be open in same window and will not give you any popup. Add all the content to Response.BinaryWrite(byte[],offset,count);
Mr.Prateek G could u please tell me how to use Response.BinaryWrite method what are the values i have to give for the attributes byte, offset and count i have never used this Response.BinaryWrite method i am getting only the path and filename
-
its working in local system but if i try to open it in another system which is connected through lan again that filedownload window is opening sir
This is a sure sign that your overall design is broken, because it's working when your code can assume that the client is the server.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Mr.Prateek G could u please tell me how to use Response.BinaryWrite method what are the values i have to give for the attributes byte, offset and count i have never used this Response.BinaryWrite method i am getting only the path and filename
Try this string sourceFile = "C:\\Documents and Settings\\PrateekGupta\\Desktop\\pref.xml"; Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/octet-stream"; FileInputStream filIpStrm = null; MemoryStream ms = new MemoryStream(); filIpStrm = new FileInputStream(sourceFile); sbyte[] buffer = new sbyte[1024]; int len = 0; while ((len = filIpStrm.read(buffer)) >= 0) { byte[] bbuffer = new byte[1024]; System.Buffer.BlockCopy(buffer,0,bbuffer,0,1024); ms.Write(bbuffer,0,1024); } Response.OutputStream.Write(ms.ToArray(), 0, Convert.ToInt32(ms.Length)); filIpStrm.close(); Response.End(); let me know if it will work for u...