If you want to Embed any YouTube url into ASP.NET page, please got thought the below article. Here I have explained how to play youtube video in Asp net application using youtube video url.
Please create a sample Web Page with a Literal control (ID="youtubeVideo") as shown below :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PlayYouTubeVideo.aspx.cs" Inherits="PlayYouTubeVideo" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Play YouTube Video : Hima Sagar Kutikuppala</title>
</head>
<body>
<form id="myform" runat="server">
<div>
<h3>Play YouTube Video</h3>
<br />
<asp:literal ID="youtubeVideo" runat="server"></asp:literal>
</div>
</form>
</body>
</html>
Please find below the code behind code:
using System;
/// <summary>
/// Play YouTube Video
/// Author : Himasagar Kutikuppala ( www.himasagar.com )
/// </summary>
public partial class PlayYouTubeVideo : System.Web.UI.Page
{
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void Page_Load(object sender, EventArgs e)
{
string source = @"<object width='500' height='300'> ";
source = source + @"<param name='movie' value='http://www.youtube.com/v/gWtL24IEpy0'></param> ";
source = source + @"<param name='allowFullScreen' value='true'></param> ";
source = source + @"<param name='allowscriptaccess' value='always'></param> ";
source = source + @"<embed src='http://www.youtube.com/v/gWtL24IEpy0'";
source = source + @"type='application/x-shockwave-flash' allowscriptaccess='always' ";
source = source + @"allowfullscreen='true' width='500' height='300'> ";
source = source + @"</embed></object>";
youtubeVideo.Text = source;
}
}
Demo: