Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hie friends,

I have one peculiar problem.

I want to play songs in the background when a user enters on my site.
The song is chosen according to clients machine's time.

So I am retrieving client side time after login.
This fires a query on database and retrieves the appropriate song.
I store this song in a session variable.
Now I want to pass this song to play in background on my welcome page.

So I write in aspx page as.

<bgsound src='<%=Session["song"]%>' loop="infinite" balance="0" volume="0">

But the session gets cleared and I am not able to play song.

How does this happen?
I know that session never gets cleared for a particular user unless you do it.

Is there any other way to pass value to .aspx page??

Please help

Thanking you

Swapnil
Posted
Updated 18-Oct-10 23:14pm
v5
Comments
Dalek Dave 19-Oct-10 3:41am    
Edited for Grammar and Readability.

C# code

protected string song = "a.mp3";

.aspx code

<bgsound src="<%= song %>" loop="infinite" balance="0" volume="0">
 
Share this answer
 
Comments
shakil0304003 19-Oct-10 4:30am    
You do not need to use session :)
Swapnil 2009 19-Oct-10 5:13am    
sory mate..bt it doesn't work..I mean how can u store value in a variable and expect it to be available on the .aspx page.After post back the value will die. I tried it it gives me error as expected..any other method??
s.Crazy 19-Oct-10 10:10am    
I used it, in anchor. It must work, because it will die after the post back but before post back complete the value will go to the aspx. You can try it in anchor. I do not familiar to bgsound control but all of my familiar controls, it's work.
Try assigning the song path value to a hidden field and use it
 
Share this answer
 
mmm srry but i see the volume is equal to zero , is that right ?
 
Share this answer
 
Comments
Swapnil 2009 19-Oct-10 5:15am    
hey no dude..that's not the problem. u can specify value between 0 15000

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900