Friday, 29 November 2013

How to Find MAC Address or Physical Address of Your Computer in ASP.NET using C#?

Add Default aspx page for design purpose.


Default2.aspx


Default2.aspx.cs
(Write the below code in to code behind page or .cs file) 



using System.Xml.Linq;
using System.Windows.Forms;
using System.Net.NetworkInformation;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //get all network interfaces
        NetworkInterface[] netinterface = NetworkInterface.GetAllNetworkInterfaces();
        //display the physical address of the first network interface in the array,
        //which should correspond to our mac address
        Label1.Text = netinterface[0].GetPhysicalAddress().ToString();
    }
   
}
 Descriptions:


Let’s review what this code is actually doing. First, we create an array of NetworkInterface objects and then populate that using the GetAllNetworkInterfaces method. Then, we display the physical or MAC address of the first NetworkInterface in the array which will correspond to your MAC address. Depending on your hardware you may want to use a different index of the array, however this will suffice for most machines.


Output: 



 

Saturday, 2 November 2013

How To Remove Shortcut Virus From Pen drive/Memory Card?



Step-1:

Click on "Start" -->Run --> type cmd and click on OK.

Here, Suppose your Pendrive/Memory Card Drive name is G.

Step-2:

Then, Enter this command.

attrib -h -r -s /s /d g:\*.*

Here,  g means your Pendrive/Memory Card Drive name.

Step-3:

You can copy the above command --> Right-click in the Command Prompt and paste it.

Step-4:

And then Press Enter

Now check for your files in Pen Drive.

Best of Luck.