Wednesday, November 05, 2008

Free ASP.NET 3.5 Training Video Downloads

Here is a list of asp.net 3.5 videos available freely from asp.net website. For your comfort I have listed the download links in a single post.

You can download and learn a lot from all of these video tutorials:

ASP.NET AJAX Support in Visual Studio 2008
The ListView Control
The DataPager Control
Visual Studio 2008 and Nested Masterpages
New Designer Support in Visual Studio 2008
JavaScript Intellisense Support in Visual Studio 2008
JavaScript Debugging in Visual Studio 2008
Multi Targeting Support in Visual Studio 2008
Quick Tour of the Visual Studio 2008 Integrated Development Environment
Creating and Modifying a CSS File
Adding AJAX Functionality to an Existing ASP.NET Page
Creating and Using an AJAX-enabled Web Service in a Web Site
How Do I: Create a Master Page in Visual Studio 2008
How Do I: Create Nested Master Page in Visual Studio 2008
How Do I: Cascading Style Sheets in Visual Studio 2008
How Do I: Working with Visual Studio 2008 .NET Framework
How Do I: Adding Elements to a CSS File and Create New CSS on the Fly
How Do I: Advance Cascading Style Sheet Features and Management
How Do I: Converting a .NET 2.0 Windows Forms Application to .NET 3.5
How Do I: Get Started with the Entity Framework
How Do I: Use the New Entity Data Source
ASP.NET AJAX: A demonstration of ASP.NET AJAX
How Do I: Serialize a Graph with the Entity Framework
Watch ASP.NET Development in Action
How Do I: Use MSBuild to Automate the ASP.NET Compiler and Merge Utilities

I hope you'll enjoy these videos.

Friday, February 15, 2008

Find if network is available and connected using C#

There are different ways to find out manually that whether we're connecte to some network or not. But how we do this via programming - especially in .Net? In this post I'll give you the idea to find out that if we're connected to the network or not. This code snippet can also give us the number of the networks available to our machine.

In order to find out connected networks in Microsoft.Net using either C# or Visual Basic.Net we can use System.Management namespace. There are two classes available in this namespace that can help us achieve this goal. These two calsses are ObjectQuery and ManagementObjectSearcher. The following code snippet first creates a query object that will be used to get all the networks available to our machine and then the ManagementObjectSearcher class' object will execute this query to return the results.

ObjectQuery objQuery = new ObjectQuery("select * from Win32_NetworkAdapter Where NetConnectionStatus=2");

Here NetConnectionStatus=2 means the network connections that are connected right now. Normally, these are the connections which are connected to the internet i.e. Cable, Wireless internet connection etc.

ManagementObjectSearcher searcher = new ManagementObjectSearcher(objQuery);

int connectednetworks = searcher.Get().Count;

if (connectednetworks <= 0)
return false;

Wednesday, February 13, 2008

How to ping a server programatically in .net using C#

Normally, in Windows operating system we can ping a machine using Ping command in the command window. What we need to do is just provide the IP of the target machine we want to ping. Ping command returns the response which tells us that the other machine is active on the network and available. This same kind of functionality need to be achieved via programming. In this article I'll show you the code snippet which can help you ping a system in C# or Visual Basic.Net.

Microsoft.Net framework 2.0 provides Ping class under System.Net.NetworkInformation namespace which can be used to ping an IP. Following is the snippet which let you do this:

Ping objPing = new Ping();
PingReply objPingReply = objPing.Send("IP of the Machine");

if (objPingReply.Status == IPStatus.Success)
{
return true;
}
else
{
return false;
}

Tuesday, February 12, 2008

Register a COM DLL from .Net application using C#

The problem with the COM components i.e. DLL is that they need to be registered in the windows to put them to work. Registry Server can be used to register those DLLs. While doing this task manually one need to use command window to register the DLL file using Registry Server executable. Whoever, sometimes we also need to register some DLL from our application code using either C# or Visual Basic.Net. In this post I'll show you the code to register a COM DLL using C# code. This procedure can also be used with Visual Basic.Net as well with a slight modifications in syntax.

Following code snippet uses Process class of System.Diagnostics namespace. Just create an object of process class and pass few arguments to get the DLL registered in windows.

System.Diagnostics.Process Proc = new System.Diagnostics.Process(); Proc.StartInfo.FileName = "regsvr32.exe";
Proc.StartInfo.Arguments = "filename.dll /s";
Proc.StartInfo.CreateNoWindow = true;
Proc.Start();
Proc.WaitForExit();

Monday, February 11, 2008

Open a webpage on button click in asp.net using C#

Sometimes we need to open a web page using a button click event. This post contains a sample code that can be used in a button click event to show a page using Javascript Window.open method. This code snippet is just a small piece just to give you an idea for the startup stuff. I hope you can improve, and modify it according to your need to achieve your required goal.

Here is the sample code. You can put this code in the click event of a button etc.


string strpage = "Url of the page to be opened";
string url = "";
this.RegisterStartupScript("", url);