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 July 10th, 2006, 05:38 AM
Ranine Ranine is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 4 Ranine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 40 m 46 sec
Reputation Power: 0
Angry Ringtone file name is not saved on my mobile handset

Hello,

I have created a Mobile Application in C# .net.
I am sending a WAPPush SMS for users who may request Mobile Services such as (Ringtones, Pictures).
I have a problem in downloading ringtone(True Tone of file extension AMR) on WAP Browser, the ringtone name is not saved. After downloading the Ringtone file
takes the link file name "userlink" which appears in url(ex, url: http://IP/webapplication?userlink.aspx?pwd=887768).The file name (amr) is not known on WAP Browser, so I am sending the link to users to download it .The idea is I can download file type AMR (or in MP3...) from my Web Browser but it is not saved on mobile handset in its real name just it can be heard. Also I am giving the file name through this syntax: Response.AppendHeader("Content-Disposition",

"attachment;filename="+ szFileName.Trim());
The code is Below:
Please help to fix my problem as soon as possible ...........

//*********************************************

private void Download(int szID)
{
string szContent="";
string szType="";
string szFileName="";
SqlConnection Conn = new SqlConnection(objGeneral.GetConnect());
string sqlselect="SELECT ContentUrl,Type,ContentName FROM ContentType where ID='"+szID+"' ";
Conn.Open();
SqlCommand CmdObj = new SqlCommand(sqlselect, Conn);

SqlDataReader ReaderObj = CmdObj.ExecuteReader();

if(ReaderObj.Read())
{

Response.Clear();

szContent=ReaderObj.GetString(0);
szType=ReaderObj.GetString(1);
szFileName=ReaderObj.GetString(2);
FileInfo f = new FileInfo("C:\\Inetpub\\wwwroot\\MobileServices\\"+szContent);
Response.Clear();
Response.AppendHeader("Content-Disposition:inline", "attachment;filename="+ f.Name);
Response.AddHeader("Content-Length", f.Length.ToString());
//Response.ContentType=szType ;
Response.ContentType="text/vnd.wap.wml";
Response.AddHeader("pragma","no-cache");

if(!ReaderObj.IsDBNull(2))
{


Response.WriteFile(f.FullName);
Response.End();

}
else
{
Response.Write("no image exists!!");
}
ReaderObj.Close();
}

}


Regards,
Ranine

Reply With Quote
  #2  
Old July 10th, 2006, 06:12 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,794 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th 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 3 Weeks 6 Days 15 h 40 m 58 sec
Reputation Power: 1640
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 Ranine,

Welcome to Dev Shed.

I don't really know c# at all, but shouldn't the content type be set to match the type of the file you are trying to download. (eg: audio/mpeg for mp3)

You have it as
Code:
Original - Code
    Response.ContentType="text/vnd.wap.wml";


Good list here if you are needing more info on mime types ....
__________________
Cheers,

Jamie

# mdb4u | The 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 July 10th, 2006, 07:01 AM
Ranine Ranine is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 4 Ranine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 40 m 46 sec
Reputation Power: 0
Angry Ringtone file name is not saved on mobile handset.....

Quote:
Originally Posted by jabba_29
Hi Ranine,

Welcome to Dev Shed.

I don't really know c# at all, but shouldn't the content type be set to match the type of the file you are trying to download. (eg: audio/mpeg for mp3)

You have it as
Code:
Original - Code
    Response.ContentType="text/vnd.wap.wml";


Good list here if you are needing more info on mime types ....


hi Jabba:

Yes that's right the content type should match the file type which is retrieved from Database. But as I told you the Ringtone file wasn't saved on my mobile after downloading.
Here in the code above I was trying to change the Response.ContentType="text/vnd.wap.wml";
it has given me this error:
//*************************
HTTP Error : 400 (Bad Request)
<html><body>Bad Request</body></html>
//*********************************

I think that maybe the main reason for such error as the source code userlinks.aspx.
Please Jabba in your opinion do I have to change the C# code into WML? if So can you help me....

Regards,
Ranine

Reply With Quote
  #4  
Old July 10th, 2006, 07:24 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,794 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th 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 3 Weeks 6 Days 15 h 40 m 58 sec
Reputation Power: 1640
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
Is userlink.aspx the page that the snippet of code is taken from?

The file is actually in a database - is it stored in the correct format there?
Have you tried the same code but made it available to a web browser so that you can test that it works and that the format is correct?

Your uri has "?pwd=887768" where presumably pwd relates to ID='"+szID+"' in your query - is your query successful - you don't seem to show any error trapping *.


* That may just be my lack of knowledge in c# though

Reply With Quote
  #5  
Old July 10th, 2006, 07:42 AM
Ranine Ranine is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 4 Ranine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 40 m 46 sec
Reputation Power: 0
Angry Ringtone file name is not saved on mobile handset.....

Quote:
Originally Posted by jabba_29
Is userlink.aspx the page that the snippet of code is taken from?

The file is actually in a database - is it stored in the correct format there?
Have you tried the same code but made it available to a web browser so that you can test that it works and that the format is correct?

Your uri has "?pwd=887768" where presumably pwd relates to ID='"+szID+"' in your query - is your query successful - you don't seem to show any error trapping *.


* That may just be my lack of knowledge in c# though


Hi Jabba,

Thanks on your reply.
The userlink.aspx is the snippet of Code which is taken from.
I have traced my code more than 100 times , and all what are retrieved from Database are correct like :Content name, Content length (appending the specific headers) , the correct file path..... I am in need for help !
The ringtone is saved as userlink.mp3 so it takes the file extension and it is heard properly but what about the file real name????
I can accept converting my code into WML wireless markup language maybe it will work !

Regards,
Ranine

Reply With Quote
  #6  
Old July 31st, 2006, 06:35 AM
Ranine Ranine is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 4 Ranine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 40 m 46 sec
Reputation Power: 0
Unhappy writing asp coding in WML page

Hello Jabba:

I have done the conversion from C# into Asp code in the wml page. Maybe through way I can solve the problem.
Please can you check this code and tell me if I have to do any changes.
Code:
<?xml version="1.0">
<!DOCTYPE wml PUBLIC="-//WAPFORUM//DTD WML 1.1//EN" http://www.wapforum.org/STS/wml_1.1.xml>
<wml>
<%
szpwd=request("pwd");
SubmitUserLink();

private void SubmitUserLink()


{
int szID=0;
string szFilename="";
'***************************************************************************//

'********************Submit Service******************************************//
'to download any mobile service, active should be 0
dim Con
set Con = server.CreateObject("ADODB.Connection")
Con.open "DSN=MobileService;uid=sa;pwd=Mediatech1"
'Create a recordset
set myRecordSet = server.createObject("ADODB.Recordset")
dim sql="Select ContentURL,Active,ContentID from WebLog where password='"+szpwd+"'and Active<='1'"
myRecordSet.Open sql,Con,adOpenStatic
'Read records
if myRecordSet.EOF !=null then
szContent=myRecordSet.GetString(0)
szActive=myRecordSet.GetString(1)
szID=myRecordSet.GetString(2)
UpdateWebLog()
DownloadContent(szID)
'Response.Redirect(szContent,true)
'Close connections
myRecordSet.Close
Con.Close
set myRecordSet=Nothing

else

Response.Write("Sorry you can't access this link because you've downloaded its content previously!")






}

public string UpdateWebLog()
{
'*****************Update WebLog********************************************//
szActive+=1;
dim Con
set Con = server.CreateObject("ADODB.Connection")
Con.close
Con.open "DSN=MobileService;uid=sa;pwd=Mediatech1"
set myRecordSet = server.createObject("ADODB.Recordset")
rs.Open "Exec UpdateWebLog " & szpwd & szActive ,Con
'Close connections
myRecordSet.Close
Con.Close
set myRecordSet=Nothing
return "update"
}
private void DownloadContent(int szID)
{
byte[] byteArray=null;
string szContent="";
int fileSize=0;

string szType="";
dim Con
set Con = server.CreateObject("ADODB.Connection")
Con.open "DSN=MobileService;uid=sa;pwd=Mediatech1"
set myRecordSet = server.createObject("ADODB.Recordset")
string sqlselect="SELECT * FROM ContentType where ID='"+szID+"' ";
myRecordSet.Open sqlselect,Con,adOpenStatic
'Read records
if myRecordSet.EOF !=null then


Response.Expires = 0;
Response.Buffer=true;
Response.Clear();
byteArray=(byte[]) myRecordSet["ContentBinary"];
szContent=myRecordSet.GetString(6);

szType=myRecordSet.GetString(7);
fileSize=byteArray.Length ;
Response.AddHeader("Content-Length", szContent.Length.ToString());
Response.ContentType=szType ;
Response.AppendHeader("Content-Disposition", "attachment;filename="+ szContent);
Response.AddHeader("pragma","no-cache");
if(!myRecordSet.IsDBNull(2))
{

BinaryReader bReader=new BinaryReader(new MemoryStream(byteArray));
Response.BinaryWrite(bReader.ReadBytes((int) bReader.BaseStream.Length));
Response.Flush();
Response.End();
bReader.Close();
}
else
{
Response.Write("no image exists!!");
}
}
}






%>

</wml>
******************************************
Thanks Ranine

Reply With Quote
  #7  
Old December 4th, 2007, 03:55 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
string Name = dsDownload.Tables[0].Rows[0]["RingtoneFileName"].ToString();
string Format = dsDownload.Tables[0].Rows[0]["RingtoneFileFormat"].ToString();
string strFileName = Name + "." + Format;

//THIS CODE IS WRITTEN TO INCREMENT THE NO OF COUNT IN THE DATABASE
//IncrementFileDownloadCount(RingtoneID);
//CODE END
string originalFilename = strFileName;
string localfilename = Server.MapPath("~/RingtoneFiles") + "/" + strFileName;
WebClient req = new WebClient();
CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri(localfilename), "Basic", new NetworkCredential("administrator", "admin$123"));
req.Credentials = mycache;
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearContent();
response.ClearHeaders();
response.Buffer = true;
response.AddHeader("Content-Disposition", "attachment;filename=\"" + originalFilename + "\"");
Response.AddHeader("Content-Type", "audio/mpeg");
byte[] data = req.DownloadData(localfilename);
response.BinaryWrite(data);
response.End();
return;


Please help me out from this problem

Reply With Quote
  #8  
Old December 4th, 2007, 05:54 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,794 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th 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 3 Weeks 6 Days 15 h 40 m 58 sec
Reputation Power: 1640
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
Welcome yoge.

This thread is over a year old, and am sure the OP has long gone.
Please do not cross post.

You have already started another thread, leave this one be

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreMobile Programming > Ringtone file name is not saved on my mobile handset


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 |