Software Programs and Projects

This Software Programs and Projects include programing tips and technology using different languages like VC++,ASP,JSP C#.Net,PHP,VB.Net,JavaScript,ASP.NET .Software Programs and Projects blog mainly support to software programmers and provide help through the mail.

How to display video in windows Mediaplayer using C#.net in ASP.NET


Html

Add windows media player using class id and embeded into the gridview control using object id="Player" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6

<asp:GridView ID="GrdVideo" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<object id="Player" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" height="300"
width="300">
<%--<param name="BorderStyle" value="1" />
<param name="MousePointer" value="0" />
<param name="Enabled" value="1" />
<param name="Min" value="0" />
<param name="Max" value="10" />--%>
<param name="url" value='<%#Eval("Video")%>' />
<param name="play" value="0" />
</object>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>


Code

Get values from the database (video Path) and binding into the Gridview control using DataTable .Example for creating Datatable

DataTable myDataTable = new DataTable();
DataColumn myDataColumn;
myDataColumn = new DataColumn();
myDataColumn.DataType = Type.GetType("System.String");
myDataColumn.ColumnName = "Video";
myDataTable.Columns.Add(myDataColumn);
DataRow row;
row = myDataTable.NewRow();
row["Video"] = strUrl;
myDataTable.Rows.Add(row);
GrdVideo.DataSource = myDataTable.DefaultView;
GrdVideo.DataBind();


How can display VLC ( Video Lan ) Player in ASP.NET


How to display video in windows Mediaplayer using C#.net in ASP.NET


Get All Windows Services and Service Path in ASP.NET using C# .Check If directory and Files existing in the current location. This code also explain how to get values from the xml document.

protected void Button1_Click(object sender, EventArgs e)
{
//Get All Windows Services
RegistryKey services = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services");
if (services != null)
{
//Get Service Path
object pathtoexecutable = services.OpenSubKey("KTSInfoMateServer").GetValue("ImagePath");
string strServicePath = pathtoexecutable.ToString();
int iStartPosition = strServicePath.LastIndexOf('\\');
string strServiceFoldePath = strServicePath.Remove(iStartPosition);
strServiceFoldePath = strServiceFoldePath.Replace('\\', '/');
strServiceFoldePath = strServiceFoldePath.Remove(0, 1);
strServiceFoldePath += "/";
try
{
//Check Direcory Existing
DirectoryInfo objDirectoryInfo = new DirectoryInfo(strServiceFoldePath);
if (objDirectoryInfo.Exists)
{
//Check File Existing in the Service directory
string strSettingsFileName = strServiceFoldePath + "/" + "EmSettings.xml";
FileInfo objFileInfo = new FileInfo(strSettingsFileName);
if (objFileInfo.Exists)
{
XmlNode xNode;
XmlDocument objDoc = new XmlDocument();
objDoc.Load(strSettingsFileName);
string strSettingsXML = objDoc.InnerXml;
XmlNode inXmlNode = objDoc.DocumentElement;
XmlNodeList nodeList;
if (inXmlNode.HasChildNodes)
{
nodeList = inXmlNode.ChildNodes;
for (int iNodeIndex = 0; iNodeIndex <= nodeList.Count - 1; iNodeIndex++)
{
xNode = inXmlNode.ChildNodes[iNodeIndex];
if (xNode != null)
{
if (xNode.Name == "StreamingPort")
{
m_strStreamingPort = xNode.InnerText.ToString();
break;
}
}
}
}
Preview();
lblStatus.Text = "File Exists";
}
else
{
lblStatus.Text = "Not Exists";
}
}
}
catch (Exception objException)
{
string strErrorMessage = objException.Message.ToString();
}

}

}

tag:-
Get All Windows Services and Service Path in ASP.NET using C# .Check If directory and Files existing in the current location. This code also explain how to get values from the xml document.