How to show youtube video in ASP.Net web page?

You can configure these properties when you show a youtube video in your asp.net webpage:

VideoUrl: This property allows you to set URL of the video.
Width: Sets the width of the video player
Height: Set the height of the video player

We use variable youtube url that value initialize at run time. We can set the value of variable by fetch the url that store from data base or by passing page label.

code:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
<param name="src" value="<%=youtubeurl %>" />
<embed type="application/x-shockwave-flash" width="425" height="344" 
  src="<%=youtubeurl %>">
</embed>
</object>

write the code on your .cs page:

public string youtubeurl;
    protected void Page_Load(object sender, EventArgs e)
    {
        youtubeurl="http://www.youtube.com/v/oZdnezj9Dfg&amp;hl=en&amp;fs=1";
    }

Like above code we initialize variable at page load.

Author: Pavan

I am asp.net developer have good knowledge of Asp.net ver 05,08,10 and good hand in sql server.Proficient in Object Oriented Programming and javascript, jQuery. Achievements - Integrate Spotfire, appnexus API ASP.net with sql server. Hobbies - Blogging ,Games, Movies ,Teaching,Keeping myself update with new technologies

2 thoughts on “How to show youtube video in ASP.Net web page?”

  1. i am tried with this code
    and no video window also not displaying here.what is the reason 

  2. Hello Anu,
                  Please send us code that ur using now with detail which youtube link ur using like embed link or normal link.

    Thanks
    pavan 

Comments are closed.