473,387 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.QueryString["id"];
if (SessionId != "")

{

FileStream fs;

string szFilePath =
System.Configuration.ConfigurationManager.AppSetti ngs["Path"];

string szFileName = GetFileName(SessionId);

szFilePath = szFilePath + szFileName;

fs = File.Open(szFilePath, FileMode.Open);

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

fs.Read(byteBuffer, 0, (int)fs.Length);

fs.Close();

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

Response.ContentType = "application/octet-stream";

Response.BinaryWrite(byteBuffer);

Response.End();

}

}

}

}

Thanks a lot for your help really appreciated

Mustafa Rabie
Jun 28 '06 #1
0 1115

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

Similar topics

4
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...
13
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...
4
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
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...
1
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...
0
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...
1
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...
4
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
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.