473,563 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Force Download PocketIE and Mobile Browsers

Hi All,

I am writing an ASP.NET 2.0 Web Application that users can buy and download
pictures, songs, etc. I have a page that servers as the download page that
fetches the file to be downloaded from a physical path on my server,pops up
the Save As dialog and using HTTP Response downloads the file. It works
great off desktop IE, but when i try the same page from PocketIE it just
fetches the image and displays it in IE. How can i make it popup the Save
As dialog in PocketIE? any ideas or maybe another way that this could be
reached?

Here's the code i am using:

if (!IsPostBack)

{

string SessionId = "";

SessionId = Request.QuerySt ring["id"];
if (SessionId != "")

{

FileStream fs;

string szFilePath =
System.Configur ation.Configura tionManager.App Settings["Path"];

string szFileName = GetFileName(Ses sionId);

szFilePath = szFilePath + szFileName;

fs = File.Open(szFil ePath, FileMode.Open);

byte[] byteBuffer = new byte[fs.Length];

fs.Read(byteBuf fer, 0, (int)fs.Length) ;

fs.Close();

Response.AddHea der("Content-disposition", "attachment ; filename=" +
szFileName);

Response.Conten tType = "applicatio n/octet-stream";

Response.Binary Write(byteBuffe r);

Response.End();

}

}

}

}

Thanks a lot for your help really appreciated

Mustafa Rabie
Jun 28 '06 #1
0 1122

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
21929
by: Kevin Muenzler, WB5RUE | last post by:
How do I force a browser to download a file instead of displaying it? In other words I have a page with MP3 and WMA files on it and I would like for the visitor to download the file instead of play it without having to right-click and save. How can I force the browser to pop up the "save file as" dialog box instead of playing it? I know...
13
51673
by: ron1972 | last post by:
Hi I have a large pdf file that if I create an anchor link to, the browser will try to open the file, which takes quite a long time. Is there a way to force the browser to download the file rather than try to open it? Thankss
4
1684
by: Microsoft | last post by:
I have a font that most systems will not have. How do I get the font to the client. The font is identified in the CSS page. TIA, Steve
1
1885
by: suresh_nsnguys | last post by:
Hi to all, I am new to this forum,I am new to this mobile technology.Right now i am creating one website using XHTML MP and PHP. I don't know how to download a binary file to mobile from PHP.Is it possible to download a file to mobile similar to desktop(PC) - like displaying 'save as ' dialog box. I want...
1
2156
by: JayLembeck | last post by:
Over 50,000 Free Ringtone. Get the Latest Ringtone. Download now- Fast, Free and Easy. Get your FREE surprise RINGTONE now! http://seekoutfast.info/free-ringtone/ free ringtone free ringtone new ringtone popular ringtine download ringtone download verizon ringtone download cingular ringtone download mosquito ringtone download mp3 ringtone download...
0
1710
by: RhettSpencer | last post by:
Hello, I am developing an ASP.NET application in C#. the intended target is mobile web browsers on phones like the treo. When doing a postback so that data can be updated the Windows Mobile phones do not refresh the page content. The Palm phones do show you the updated information and work the same as internet explorer on your computer, the...
1
3663
by: OldYgg | last post by:
Hello Everyone, and thanks for any help if you are able to do so. I'm an experience programmer with web development and I've developed code through ASP, ASP.NET, VB.NET VB, ABAP, SQL, etc. I'm being frustrated in order to set focus on a input text box on mobile browsers. 1) I need functionality where the user hits the enter key, I submit...
4
7082
by: howa | last post by:
Hello, Any best practice in checking mobile device and re-direct them into mobile page (e.g. wap) ? E.g. User agent, screen size etc.? anything else?
5
2335
by: rn5a | last post by:
I've come across numerous mobile phones with which ASP.NET pages can be accessed on the Internet. Then why has Microsoft developed a separate programming model to create ASP.NET apps for mobile devices when regular ASP.NET pages can be accessed from mobile devices? Ron
0
7579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7630
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7941
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5479
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5201
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2077
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.