Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 4th, 2007, 04:06 PM
yogendratrivedi yogendratrivedi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 2 yogendratrivedi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 49 sec
Reputation Power: 0
Mp3 file download as .aspx file and not open on phone player

I have the same problem , i also create a mobile application ain asp.net to download mp3 file on cell phone.
But i find that when i access the page from cell phone , file save and displayed as wapauthenticate.aspx not as <filename>.mp3, opened by the media player after downloading?

For more reference i add my download code
asp Code:
Original - asp Code
  1. string Name = dsDownload.Tables[0].Rows[0]["RingtoneFileName"].ToString();
  2. string Format = dsDownload.Tables[0].Rows[0]["RingtoneFileFormat"].ToString();
  3. string strFileName = Name + "." + Format;
  4.  
  5. //THIS CODE IS WRITTEN TO INCREMENT THE NO OF COUNT IN THE DATABASE
  6. //IncrementFileDownloadCount(RingtoneID);
  7. //CODE END
  8. string originalFilename = strFileName;
  9. string localfilename = Server.MapPath("~/RingtoneFiles") + "/" + strFileName;
  10. WebClient req = new WebClient();
  11. CredentialCache mycache = new CredentialCache();
  12. mycache.Add(new Uri(localfilename), "Basic", new NetworkCredential("administrator", "admin$123"));
  13. req.Credentials = mycache;
  14. HttpResponse response = HttpContext.Current.Response;
  15. response.Clear();
  16. response.ClearContent();
  17. response.ClearHeaders();
  18. response.Buffer = true;
  19. response.AddHeader("Content-Disposition", "attachment;filename=\"" + originalFilename + "\"");
  20. Response.AddHeader("Content-Type", "audio/mpeg");
  21. byte[] data = req.DownloadData(localfilename);
  22. response.BinaryWrite(data);
  23. response.End();
  24. return;



Please help me out from this problem

Last edited by jabba_29 : December 4th, 2007 at 05:44 PM.

Reply With Quote
  #2  
Old December 4th, 2007, 05:47 PM
jabba_29's Avatar
jabba_29 jabba_29 is online now
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,912 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Weeks 1 Day 13 h 8 m 9 sec
Reputation Power: 1693
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Hi yoge, I know next to nothing about .net programming,
but I feel that you need to add filesize(Content-length) at least as a "response.AddHeader".

HTH.
__________________
Cheers,

Jamie

# mdb4u | mobile movie database] | Please help to test and promote
# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.



__________________

Reply With Quote
  #3  
Old December 4th, 2007, 10:30 PM
SH[Y]man SH[Y]man is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 1 SH[Y]man User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 36 sec
Reputation Power: 0
Post try>> http://website/download.aspx/myringtone.mp3

if you have download link : http://website/download.aspx?id=1234, most mobile will save the content you're flushing using "download.aspx" as file name instead of what you have specified in Content-Disposition header

as you can see, most mobile will use the file name its accessing into, so...to solve this problem you can put the url instead into this one :
http://website/download.aspx/myringtone.mp3
to ensure the phone to save it as "myringtone.mp3"

the question is, "hey, it will return HTTP 404 Error File Not Found", but fortunately asp.net and php already that smart that they know we're actually want to access "download.asp" instead of "myringtone.mp3"
so...when ever user contact url http://website/download.aspx/myringtone.mp3, they will contact "download.aspx", instead of giving error
try it...

***

now...its my turn, I'm still using the "old" asp, and unfortunately the feature I said above is not yet available
I just cant simply use url : http://website/download.aspx/myringtone.mp3, it will give either HTTP 404 not found or...HTTP 500 IIS Error

so, if anyone who know how-to solve this problem in asp, pls advice, thx...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreMobile Programming > Mp3 file download as .aspx file and not open on phone player


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT