Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7952401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:51:04+00:00 2026-06-04T02:51:04+00:00

protected void Button2_Click(object sender, EventArgs e) { UploadLogic bl = new UploadLogic(); input =

  • 0
protected void Button2_Click(object sender, EventArgs e)
{
    UploadLogic bl = new UploadLogic();
    input = ListBox1.SelectedIndex >= 0 ? ListBox1.SelectedItem.ToString() : "";
    DataSet ds = new DataSet();
    ds = bl.Content_details(input);

    if (ds.Tables[0].Rows.Count > 0)
    {
        Byte[] bytes = (Byte[])ds.Tables[0].Rows[0].ItemArray.GetValue(3);
        Response.Buffer = true;

        Response.Charset = "utf-16";

        Response.Cache.SetCacheability(HttpCacheability.NoCache);

        Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250");

        Response.ContentType = ds.Tables[0].Rows[0].ItemArray.GetValue(2).ToString();

        Response.AddHeader("content-disposition", string.Format("File_Path; filename={0}", input));

        Response.OutputStream.Write(bytes, 0, input.Length);
        Response.BinaryWrite(bytes);

        Response.Flush();

        Response.End();
    }
    else
    {
        Label1.Text = "No File Found..!";
    }
}

I wrote this code, but it only downloads the file from the database. If I want to play audio and video, then how can I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:51:06+00:00Added an answer on June 4, 2026 at 2:51 am

    First of all in you code you just get and send the file (video or audio) and you think that the browser knows what to do with. The browser from the other side is going to decide in two thinks, one to show/play in a full page what you send, or just ask for download. Because is find the File_Path, is decide to ask the user for the download.

    Now how to actually play an audio or a video to web page. Most of browsers until now is not support the direct play of an audio/video and the solution to that is the use of the adobe flash player. Using a player that is made on adobe you can send it to it a video/audio file (to the correct format) and he can play it. Also the Microsoft silverlight can do the same.

    Now with the new browsers and html 5, you can direct play audio and video on a page.

    So its up to you to decide what way you going to follow, flash,silverlight,html5.

    Some examples:

    Direct play audio/video using html5

    http://www.w3schools.com/html/html_videos.asp

    http://www.w3schools.com/html/tryit.asp?filename=tryhtml_video_html5_4

    http://www.web-video-player.com/

    http://jplayer.org/latest/demos/

    Play audio/video using the “Flash Player”

    http://flowplayer.org/

    http://applian.com/flvplayer/

    Play audio/video using the Silverlight

    http://slvideoplayer.codeplex.com/

    http://openvideoplayer.sourceforge.net/

    http://www.longtailvideo.com/players/jw-wmv-player/

    How to send the video on the player

    let see this part of code:

    <embed width="320" height="240" src="movie.swf">
    

    in this code the movie.swf is the file that you like to play. To direct get it from database what you must do is to change that to a handler and from that handler you send this file.

    <embed width="320" height="240" src="loadmovie.ashx?movie.swf">
    

    Now inside the loadmovie.ashx you run your code that reads the movie/audio from the database and then send it to the player, and the parameters are coming from the url line.

    How to open it in the page

    I see that you try to show the video on button click. The better way is to use a link that opens a new page that contains the video, or open a javascript window inside the page and show it, or just show a div block inside the page and show it. Look at this examples http://highslide.com/#examples on the “YouTube w/fade effect” to get an idea for how to open it in the same page and play it.

    relative: how to work with videos in ASP.NET?

    how to play sounds in asp.net using vb.net?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

protected void Button2_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(Data Source=KING;Initial Catalog=semasinter;Integrated
protected void Button1_Click(object sender, EventArgs e) { System.Collections.ArrayList list = new System.Collections.ArrayList(); list.Add(abc); list.Add(xyz);
Then: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckBoxList1.Items.Add(new ListItem(item1)); CheckBoxList1.Items.Add(new
protected void Button2_Click(object sender, EventArgs e) { string ad = TextBox1.Text; string firma =
protected void Button1_Click(object sender, EventArgs e) { TableRow tb = new TableRow(); TableCell tc
protected void Button1_Click(object sender, EventArgs e) { MailMessage message = new MailMessage() { Subject
Hashtable values = new Hashtable(); protected void Button1_Click(object sender, EventArgs e) { Random r
protected void Button2_Click(object sender, System.EventArgs e) //logout { if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated) { System.Web.HttpContext.Current.Session.Abandon(); // it
My code: protected void Button1_Click(object sender, EventArgs e) { CustomControl myControl = new CustomControl();
protected void Button3_Click(object sender, EventArgs e) //export { GridView2.AllowPaging = false; GridViewExportUtil.Export(Сводка.xls, this.GridView2); GridView2.AllowPaging

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.